dynamic moving average (usd/jpy)
Forums › ProRealTime English forum › ProOrder support › dynamic moving average (usd/jpy)
- This topic has 6 replies, 2 voices, and was last updated 6 years ago by Nicolas.
-
-
10/30/2017 at 10:20 AM #5088110/30/2017 at 10:28 AM #50905
Hi DEIO, thanks for sharing this idea with us.
You will find here the test of the strategy realized on 200.000 bars. this is not a problem for me because as you indicated, the parameters have been optimized over a short period of time. That’s why a walk forward analysis should be conducted to test your concept of dynamic moving average periods.
In this respect, I am surprised how you calculate them, from where does this idea come from? Even if the calculation seems “wacky” (no offense), it seems that there is a truth in the recognition of periods of range ..
1DV = AverageTrueRange[CLOSE*4](close) * CLOSEI “graphed” the DV variable in the screenshot below.
10/30/2017 at 10:35 AM #50907I found why the DV variable is sometimes flat, it happens when the calculated period [CLOSE*4] is not a round number and the calculation of the indicator cannot be done. That’s why no orders could be launched at that time, so it does affect a lot the behavior of your strategy. I’m afraid that the strategy could not be validated in its current state 🙁
The DV variable should be calculated with:
123DV = max(1,round(AverageTrueRange[round(CLOSE*4)](close) * CLOSE))return dvHowever, this could also lead us to find the right threshold to determine a range period or not.
10/30/2017 at 12:16 PM #50921Hi Nicolas,
you are right about rounding (in the fisrt version I used it and during the tests I forgot to insert it again).
Now I have rounded during the calculation of Averages (fast and slow):
MMFAST= Average[ROUND(DV/12)](close)
MMSLOW= Average[ROUND(DV/1)](close)On internet I read about the idea to generate dynamic averages…
So my method could be a bit wacky, as you said, but my intent is to find a way to avoid that the two averages were fixed
during the time, because if in a certain period is good the combination (fast=2 and slow=10) in onother one is better 1 / 9 and so on..
DV has been calculated this way in order to have the possibility to obtain the fast average value (by division by a number – the proper one is now 12 ), while slow average remain DV (rounded !!) 🙂
Obviously for other crosses, parameters must be reviewed.
Please let me know.
bye
10/30/2017 at 2:50 PM #50930I didn’t review you code but the rounded value must be made with the averagetruerange period first, this is where is the trouble, because this is where is calculated the “dynamic” period. So DV calculation must be replaced with the version I post here.
10/30/2017 at 4:08 PM #50942hi Nicolas,
here the code reviewed with a little modify on DV calculation (in addition to your suggestion).
Please le t me know if in the past it works or not.
thx again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445//-------------------------------------------------------------------------// CROSS_MM// USD/JPY// TF 45 MIN//----------------------------------------------------------------------------------------// DV IS A VARIABLE DEPENDING ON THE VOLATILITY OF THE MARKET// THIS WAY AVERAGES (FAST AND SLOW) CHANGE DURING THE TIME, ACCORDING TO THE MERKET BEHAVIOUR//-----------------------------------------------------------------------------------------// 1 spread point// no money management applied//----------------------------------------------------------------------------------------//if you want not to keep over overnight the position remove the comment from// the following parameter://defparam flatafter = 211500//-----------------------------------------------------------------------------------------defparam flatbefore = 071500SIZE = 1DV = max(1,round(AverageTrueRange[round(CLOSE*2.5)](close) * Average[320](close)))//GRAPH DVMMFAST= average[max(1,ROUND(DV/12))] (close)MMSLOW= average[max(1,ROUND(DV/1))] (close)condUP = MMFAST CROSSES OVER MMSLOWcondDW = MMFAST CROSSES UNDER MMSLOWCONDUP2 = HIGH[0] CROSSES OVER high[13]CONDDW2 = LOW[0] CROSSES UNDER low[13]IF CONDUP AND CONDUP2 THENIF SHORTONMARKET THENEXITSHORT AT MARKETENDIFIF NOT LONGONMARKET THENBUY SIZE shares at MARKETENDIFENDIFIF CONDDW AND CONDDW2 THENIF LONGONMARKET THENSELL AT MARKETENDIFIF NOT SHORTONMARKET THENSELLSHORT SIZE shares at MARKETENDIFENDIFSET STOP PLOSS DV*310/30/2017 at 5:47 PM #50951 -
AuthorPosts
Find exclusive trading pro-tools on