Drake Delay Stochastic
Forums › ProRealTime English forum › ProBuilder support › Drake Delay Stochastic
- This topic has 9 replies, 4 voices, and was last updated 4 years ago by roywill.
-
-
03/29/2018 at 10:56 PM #66732
Hi guys,
I know this indicator does repaint, but I need it in PRT to apply a very proficient strategy I already use in FX with MT4.
It is a stochastic used to trace tops and bottom.
I will discuss this strategy in a new post as soon I can try it.03/29/2018 at 10:58 PM #6673403/29/2018 at 11:24 PM #66739I moved your thread to the English Probuilder support, since you wrote your posts in English.
For conversions, please follows these rules https://www.prorealcode.com/topic/free-conversion-mt4-indicators-mql4/
Thank you.
03/30/2018 at 9:20 AM #66763You already asked for this conversion in another topic: https://www.prorealcode.com/topic/drake-delayed-stocastic-da-mq4-a-prt/
I told you that it is not possible, you’ll never get the same curves on your chart. This is what you’ll get when non repainting:
this is the code:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758defparam calculateonlastbars=2000Slw = 8Pds = 13Slwsignal = 9if barindex>Pds thensmconst = 2 / (1+Slw)smconst1 = 2 / (1+Slwsignal)prev = MAvalue2[1]AA = 0tmpDevAA = Highest[Pds](high)[Pds] - Lowest[Pds](low)[Pds]if (tmpDevAA <> 0) thenAA = 100* ((Close - Lowest[Pds](low)[Pds]) / tmpDevAA)endif// ---MAValue2 = smconst * (AA-prev) + prev//-----------MyHigh = -999999MyLow = 99999999for i = 1 to Pds doPrice = MAValue2[i]if( Price > MyHigh ) thenMyHigh = Priceendifif( Pds <= 0 ) thenMyHigh = Priceendifif( Price < MyLow ) thenMyLow = Priceendifif( Pds <= 0 ) thenMyLow = Priceendifnextprev1 = MAValue[1]aa1=MAValue2bb= 0if ((MyHigh-MyLow) <> 0) thenbb=100*(aa1-MyLow)/(MyHigh-MyLow)endifMAValue = smconst * (bb-prev1) + prev1prev2=MAValue2[1]//GetIndexValue2(shift+1);prev3=MAValue//GetIndexValue(shift);mavalue3= smconst1 * (prev3-prev2) +prev2endifreturn mavalue,mavalue303/30/2018 at 4:22 PM #66816Thank you very much Nicolas, I will compare the result with the MT4 version and see if results are what I am looking for.
Anyway, I found another version without repainting (words of author), would you mind to give it a look?
Thanks again
06/29/2020 at 12:51 AM #137445Hello,
I am new to coding with PRT. I used the above code as an indicator on my chart and all was good. I then created an automated strategy what didnt do what I thought. The explanation I think maybe that the above code is delayed, or repaints. Although I thought this is unlikely on the PRT platform. I am at a bit of a loss as to what is happening. Not really sure how to go about debugging it. For instance, in the above code that returns mavalue and mavalue3. Lets say we want to code a simple crossover strategy. In the backtest I believe the two values mavalue and mavalue3 are always zero, and so no trades happen.
On a totally different track. I still have not got my head around having my code automatically saved. I have lost my code about 20 times in last two weeks. I now always copy to a notepad. I have also exported and when I name it to save I added a “-1”. For instance, “My Strategy v1.itf” becomes “My Strategy v1-1.itf”. It exports fine, but when I go to import the “-1” suffixed version it says “My Strategy v1.itf” already exists. It is like it just does not register the “-1” as part of the name. Very confusing to me.
Other than that I am enjoying the speed at which I can test ideas but a major limitation is only having 10000 bars at my disposal. If my strategy is on small timeframes such as 1 or 2 minutes then this equates to only about a couple of weeks of testing, if that. Ideally I would love to be able to test my strategy over at least one or two years of M1 or M2 data. Guessing this is not possible.
Regards,
Roy
06/29/2020 at 9:09 AM #13745706/30/2020 at 8:13 AM #13761107/01/2020 at 1:56 AM #137837Hi Nicholas,
I have used the code above and just added a simple buy if mavalue above mavalue2, and sell if opposite. This is just to test whether the value is doing anything. No trades are taken which would indicate to me that the values are always equal, and in this case, zero. If that is the case, then the code is repainting….unless I am making some “newbie” mistake.07/01/2020 at 1:57 AM #137838123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475//defparam calculateonlastbars=2000Slw = 8Pds = 13Slwsignal = 9if barindex>Pds thensmconst = 2 / (1+Slw)smconst1 = 2 / (1+Slwsignal)prev = MAvalue2[1]AA = 0tmpDevAA = Highest[Pds](high)[Pds] - Lowest[Pds](low)[Pds]if (tmpDevAA <> 0) thenAA = 100* ((Close - Lowest[Pds](low)[Pds]) / tmpDevAA)endif// ---MAValue2 = smconst * (AA-prev) + prev//-----------MyHigh = -999999MyLow = 99999999for i = 1 to Pds doPrice = MAValue2[i]if( Price > MyHigh ) thenMyHigh = Priceendifif( Pds <= 0 ) thenMyHigh = Priceendifif( Price < MyLow ) thenMyLow = Priceendifif( Pds <= 0 ) thenMyLow = Priceendifnextprev1 = MAValue[1]aa1=MAValue2bb= 0if ((MyHigh-MyLow) <> 0) thenbb=100*(aa1-MyLow)/(MyHigh-MyLow)endifMAValue = smconst * (bb-prev1) + prev1prev2=MAValue2[1]//GetIndexValue2(shift+1);prev3=MAValue//GetIndexValue(shift);mavalue3= smconst1 * (prev3-prev2) +prev2endif//return mavalue,mavalue3if mavalue<mavalue3 thenif LongOnMarket thenSELL 1 CONTRACTS at MARKETendifif NOT ShortOnMarket then //and Hour[1]=11 thenSELLSHORT 1 CONTRACTS AT MARKETendifendifif mavalue>mavalue3 thenif ShortOnMarket thenEXITSHORT 1 CONTRACTS at MARKETendifif NOT LongOnMarket THEN //and Hour[1]=11 thenBUY 1 CONTRACTS AT MARKETendifendif -
AuthorPosts