Darvas Box Translation
Forums › ProRealTime English forum › ProBuilder support › Darvas Box Translation
- This topic has 9 replies, 2 voices, and was last updated 2 years ago by PeterSt.
-
-
01/19/2018 at 1:02 PM #59885
Dear Friends of Prorealtime,
if found a Darvas Box Code for Prorealtime and for Amibroker.
I think the Amibroker Code is much more powerful.
Please can you compare the Code and translate the Amibroker Darvas Box Code for ProRealtime.
I wanna be glad if you can help me.
This is the Powerful Amibroker Code:
_SECTION_BEGIN(“Darvas Box”);Periods= Param(“Darvas Periods”,5,5,260);
boxHigh = Ref(H,-3)>=Ref(HHV(H,Periods),-4) AND
Ref(H,-3)>Ref(H,-2) AND Ref(H,-3)>Ref(H,-1) AND Ref(H,-3)>H;Topbox=ValueWhen(boxHigh, Ref(H,-3));
Botbox=ValueWhen(boxHigh,LLV(L,4));/*=========================
– Allow color change
– Style change
==========================*/
Plot(TopBox, “Top”, ParamColor(“Box Top Color”, colorRed), ParamStyle(“Box Top Style”));
Plot(Botbox, “Bot”, ParamColor(“Box Bottom Color”,colorBlue), ParamStyle(“Box Bottom Style”));_SECTION_END();
And this is the much longer Darvas PRT Code.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849k=50once tth=undefinedonce ttl=undefinedn=(k*2)-4p=(n/2)-1h1=dpo[n](high)moyh=high-h1hi=(moyh-moyh[1]+(high[p])/n)*nhi=(round(hi*100))/100l1=dpo[n](low)moyl=low-l1lo=(moyl-moyl[1]+(low[p])/n)*nlo=(round(lo*100))/100low1=(round(low*100))/100high1=(round(high*100))/100if barindex > 100 thenif box=1 and (high1>tth or low1<ttl) thenbox=0flag=0endifif box=0 and flag=0 and low1<=lo[46] and low1<=lo[45] and low1<=lo[44] thenth=low1flag=1endifif box=0 and flag=1 thenfor zz=0 to 44if lo[47-zz-1]<th or lo[47-zz-2]<th or lo[47-zz-3]<th thenflag=0breakendifif hi[47-zz]>hi[47-zz-1] and hi[47-zz]>hi[47-zz-2] and hi[47-zz]>hi[47-zz-3] thenbox=1ttl=thtth=hi[47-zz]breakendifnextendifelsetth=undefinedttl=undefinedendifif box=1 thenba=ttlelseba=tthendifreturn ba coloured by box-1, tth coloured by box-1, ttl coloured by box-1So please, can you translate the Amibroker Code, to use is in PRT.
See the tow Pictures of United Heath! The Amibroker Code is much more better for Stop Loss 🙂
01/19/2018 at 5:37 PM #59910Here is the translated code for the Darvas Boxes, do you have the possibility to compare with the original code?
12345678910Periods = 5boxHigh = high[3]>=highest[Periods](high)[4] and high[3]>high[2] and high[3]>high[1] and high[3]>highif boxHigh thentopbox = high[3]botbox = lowest[4](low)endifreturn topbox coloured(255,0,0) ,botbox coloured(0,0,255)01/22/2018 at 1:00 PM #6015810/09/2018 at 5:49 PM #82385hi nicolas,
what you think of this indicator? i think he works better?
darvas box12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849k=50once tth=undefinedonce ttl=undefinedn=(k*2)-4p=(n/2)-1h1=dpo[n](high)moyh=high-h1hi=(moyh-moyh[1]+(high[p])/n)*nhi=(round(hi*100))/100l1=dpo[n](low)moyl=low-l1lo=(moyl-moyl[1]+(low[p])/n)*nlo=(round(lo*100))/100low1=(round(low*100))/100high1=(round(high*100))/100if barindex > 100 thenif box=1 and (high1>tth or low1<ttl) thenbox=0flag=0endifif box=0 and flag=0 and low1<=lo[46] and low1<=lo[45] and low1<=lo[44] thenth=low1flag=1endifif box=0 and flag=1 thenfor zz=0 to 44if lo[47-zz-1]<th or lo[47-zz-2]<th or lo[47-zz-3]<th thenflag=0breakendifif hi[47-zz]>hi[47-zz-1] and hi[47-zz]>hi[47-zz-2] and hi[47-zz]>hi[47-zz-3] thenbox=1ttl=thtth=hi[47-zz]breakendifnextendifelsetth=undefinedttl=undefinedendifif box=1 thenba=ttlelseba=tthendifreturn ba coloured by box-1, tth coloured by box-1, ttl coloured by box-1can you code a proscreener which searches for a darvas box long breakout out of the top of the box?
i tried it with that code but nothing happens 🙁
thank you
marcus
10/10/2018 at 8:53 AM #8242710/10/2018 at 1:47 PM #8245910/10/2018 at 2:54 PM #82464The last variable named “breakout” should return 1 when a breakout of the current top box occur:
123456789101112Periods = 5boxHigh = high[3]>=highest[Periods](high)[4] and high[3]>high[2] and high[3]>high[1] and high[3]>highif boxHigh thentopbox = high[3]botbox = lowest[4](low)endifbreakout = close crosses over topboxreturn topbox coloured(255,0,0) ,botbox coloured(0,0,255), breakout10/17/2018 at 12:43 PM #8296208/10/2022 at 5:43 PM #19890308/10/2022 at 6:14 PM #198907 -
AuthorPosts