Helping with a code
Forums › ProRealTime English forum › ProOrder support › Helping with a code
- This topic has 17 replies, 3 voices, and was last updated 8 years ago by
Elsborgtrading.
-
-
08/01/2016 at 6:54 PM #11073
And the indicator
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109//INDICATOR// WORKING test 2.5 Pivot strategy INDICTORINDICATEUR = 0INDICATEUR1 = 0// Conditions to enter long positionsindicator1 = Average[200](close)indicator2 = Average[50](close)c1 = (indicator1 < indicator2)indicator3 = closeindicator4 = Average[200](close)c2 = (indicator3 CROSSES OVER indicator4)//DEBUG SWITCHES 1=on 0=offRule1 = 1//PivotLongRule2 = 1//Sup1LongRule3 = 1//Sup2LongRule4 = 1//Sup3LongRule5 = 1//Res1LongRule6 = 1//Res2LongRule7 = 1//Res2LongRule11 = 1//PivotShortRule21 = 1//Sup1ShortRule31 = 1//Sup2ShortRule41 = 1//Sup3ShortRule51 = 1//Res1ShortRule61 = 1//Res2ShortRule71 = 1//Res3Short//Pivot support and resistans line definition LONGPivot1Long = (DHigh(1) + DLow(1) + DClose(1))/3S1DLong = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DHigh(1)S2DLong = (DHigh(1) + DLow(1) + DClose(1))/3-(DHigh(1)-DLow(1))S3DLong = DHigh(1)+2*(((DHigh(1) + DLow(1) + DClose(1))/3)-DLow(1))R1DLong = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DLow(1)R2DLong = (DHigh(1) + DLow(1) + DClose(1))/3+(DHigh(1)-DLow(1))R3DLong = DHigh(1)+2*((DHigh(1) + DLow(1) + DClose(1))/3-DLow(1))c3PvD = (close[1] crosses under Pivot1Long)c3S1D=(close[1] crosses under S1DLong)c3S2D=(close[1] crosses under S2DLong)c3S3D=(close[1] crosses under S3DLong)c3R1D=(close[1] crosses under R1DLong)c3R2D=(close[1] crosses under R2DLong)c3R3D=(close[1] crosses under R3DLong)c33= 1//close[1]<closePivotLong = c1 AND c2 and c33 AND c3PvD and Rule1Sup1Long = c1 AND c2 and c33 AND c3S1D and Rule2Sup2Long = c1 AND c2 and c33 AND c3S2D and Rule3Sup3Long = c1 AND c2 and c33 AND c3S3D and Rule4Res1Long = c1 AND c2 and c33 AND c3R1D and Rule5Res2Long = c1 AND c2 and c33 AND c3R2D and Rule6Res3Long = c1 AND c2 and c33 AND c3R3D and Rule7If PivotLong or Sup1Long or Sup2Long or Sup3Long or Res1Long or Res2Long or Res3Long thenINDICATEUR =1elseINDICATEUR=0Endif//REM**************************************************// Conditions to enter short positionsindicator8 = Average[200](close)indicator9 = Average[50](close)c5 = (indicator8 > indicator9)indicator10 = closeindicator11 = Average[200](close)c6 = (indicator10 CROSSES UNDER indicator11)//Pivot support and resistans line definition SHORTPivot1short = (DHigh(1) + DLow(1) + DClose(1))/3S1DShort = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DHigh(1)S2DShort = (DHigh(1) + DLow(1) + DClose(1))/3-(DHigh(1)-DLow(1))S3DShort = DHigh(1)+2*(((DHigh(1) + DLow(1) + DClose(1))/3)-DLow(1))R1DShort = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DLow(1)R2DShort = (DHigh(1) + DLow(1) + DClose(1))/3+(DHigh(1)-DLow(1))R3DShort = DHigh(1)+2*((DHigh(1) + DLow(1) + DClose(1))/3-DLow(1))c7PvD = (low[1] CROSSES over Pivot1Short)c7S1D= (low[1] CROSSES over S1DShort)c7S2D=(low[1] CROSSES over S2DShort)c7S3D=(low[1] CROSSES over S3DShort)c7R1D= (low[1] CROSSES over R1DShort)c7R2D= (low[1] CROSSES over R2DShort)c7R3D= (low[1] CROSSES over R3DShort)c77= 1//close[1]>closePivotShort = c5 AND c6 AND c77 and c7PvD and Rule11Sup1Short = c5 AND c6 AND c77 and c7S1D and Rule21Sup2Short = c5 AND c6 AND c77 and c7S2D and Rule31Sup3Short = c5 AND c6 AND c77 and c7S3D and Rule41Res1Short = c5 AND c6 AND c77 and c7R1D and Rule51Res2Short = c5 AND c6 AND c77 and c7R2D and Rule61Res3Short = c5 AND c6 AND c77 and c7R3D and Rule71IF PivotShort or Sup1Short or Sup2Short or Sup3Short or Res1Short or Res2Short or Res3Short thenINDICATEUR1 =-1elseINDICATEUR1=0ENDIFReturn INDICATEUR1 COLOURED(255,0,0), INDICATEUR COLOURED(0,0,255)08/01/2016 at 7:51 PM #1107808/01/2016 at 8:28 PM #11081Hi Jon. It is still the same, I just change the structure a bit so it looked better and was easier to edit/test. If you backtest the code along with the indicator added, you should see they are aligned. one spike=one order on next candle
PS. you are welcome- it’s a good learning experience 🙂
-
AuthorPosts
Find exclusive trading pro-tools on
Similar topics: