TradingView
lejmer
18 פבר׳ 2021 10:38

Random Synthetic Asset Generation 

EUR/USDOANDA

תיאור

This script generates pseudo-random asset data. Due to the nature of the random generator, it is impossible to use this indicator as input for other indicators because the instance of the script that the indicator is applied to will automatically be different from the instance that is plotted on the chart. Therefore, the idea is to use this script in other scripts (to make it possible to backtest on random data, for example).

The script has four main input parameters.
  • Random Number Generator Method: It supports two methods for generating the pseudo-random numbers (one by Ricardo Santos and one by Wichmann-Hill).
  • Seed: You can specify the seed to use. Each unique seed will generate a unique set of pseudo-random data.
  • Intrabar Volatility: This basically sets how volatile the generated wicks will be (0 = no wicks).
  • Price Multiplier: This is just a multiplier for the generated price data, so that you can scale up or down the generated price data.


You can also change the colors of the bars.

In addition to this, the indicator also generates random volume. In order to make it possible to show both volume and price, you need to have two identical instances of the indicator. One on the chart, and one in its own panel. Then, go into the Style tab in the indicator settings on the instance in the panel. Untick Up-Candles and Down-Candles boxes, and tick the Volume box.

In a similar manner, you can also plot the true range data and the candle change data as well, by ticking one of those boxes instead.

הערות שחרור

Fixed a small bug.
תגובות
PineCoders
POWER_OF_FOREX
allanster
Extremely useful, great work!
ChristinaKrechel
It was great to see your work
PineCoders
This publication is now featured in our Editors' Picks: tradingview.com/scripts/editors-picks/ .
In the name of all TradingViewers, thank you for your valuable contribution to the community, and congrats!
lejmer
@PineCoders, Thank you! :)
duyanh6978
Sir, how can i add volume
lejmer
@duyanh6978, Load up two instances of the indicator, and on one of them, go to the indicator settings and click on the Style tab. When there, untick Up-candles and Down-candles and make sure Volume is ticked, then press OK. When you're done, move your mouse to the indicator name of the one where you modified the Style settings and click on the three dots (...). Then select "Move to" and click on "New pane below".
teknium
Would this be able to simulate 3x leveraged etfs, like SPXL/UPRO, for periods prior to the etf's existing?
lejmer
@teknium, It isn't based on chart data, so no. You could generate random data from the empirical distribution of returns though, to simulate what you're after. But not using this indicator.
עוד