Silly Q exit x points after entry not working
Forums › ProRealTime English forum › ProOrder support › Silly Q exit x points after entry not working
- This topic has 25 replies, 3 voices, and was last updated 8 years ago by Cosmic1.
-
-
05/26/2016 at 9:00 AM #8077
Hi Cosmic,
Please change the line 37 to 45 with this code instead:
123456789if longonmarket thenset stop ploss 40set target pprofit 25endifif shortonmarket thenset stop ploss 30set target pprofit 25endifTo test if it’s ok. In your broker orders list, do you see the takeprofit and stoploss values?
05/26/2016 at 9:02 AM #8078Sorry Cosmic1, were too late and didn’t test it, my fault… above code is wrong, here you have it, tested:
1234567891011121314151617181920212223242526272829303132333435363738DEFPARAM CUMULATEORDERS = FALSEDEFPARAM FLATAFTER = 205500// One Trade Per DayOnce nbTrades = 0Once tradesPerDay = 1If Day<>Day[1] thennbTrades = 0ElseIf (Not OnMarket[1] and OnMarket) xor (ShortOnMarket[1] and LongOnMarket) xor (LongOnMarket[1] and ShortOnMarket) thennbTrades = nbTrades + 1EndifEndifIf nbTrades < tradesPerDay then//End One Trade Per Day Codecashhigh = highest[180](high)cashlow = lowest[180](low)ENDIFIF NOT LONGONMARKET AND Time > 173000 AND Time <= 193000 THEN//Enter LongsBUY 1 PERPOINT AT cashhigh-5 STOPset stop ploss 40set target pprofit 25ENDIF//Enter ShortsIF NOT SHORTONMARKET AND Time > 173000 AND Time <= 193000 THENSELLSHORT 1 PERPOINT at cashlow+5 STOPset stop ploss 30set target profit 25ENDIFCheers
05/26/2016 at 12:22 PM #811905/26/2016 at 2:22 PM #813305/26/2016 at 2:52 PM #8150This should fix the one trade per day issue:
12345678910111213141516171819202122232425262728293031323334353637DEFPARAM CUMULATEORDERS = FALSEDEFPARAM FLATAFTER = 205500// One Trade Per DayOnce nbTrades = 0Once tradesPerDay = 1If Day<>Day[1] thennbTrades = 0ElseIf (Not OnMarket[1] and OnMarket) xor (ShortOnMarket[1] and LongOnMarket) xor (LongOnMarket[1] and ShortOnMarket) thennbTrades = nbTrades + 1EndifEndifIf nbTrades < tradesPerDay then//End One Trade Per Day Codecashhigh = highest[180](high)cashlow = lowest[180](low)IF NOT LONGONMARKET AND Time > 173000 AND Time <= 193000 THEN//Enter LongsBUY 1 PERPOINT AT cashhigh-5 STOPset stop ploss 40set target pprofit 25ENDIF//Enter ShortsIF NOT SHORTONMARKET AND Time > 173000 AND Time <= 193000 THENSELLSHORT 1 PERPOINT at cashlow+5 STOPset stop ploss 30set target profit 25ENDIFENDIF05/26/2016 at 2:59 PM #8151Hi, It does and I tried moving the IF’s as you did above but it now doesn’t follow the separate stops and limits. Longs and shorts both get stopped at 20points when using this code.
12345678910111213141516171819202122232425262728293031323334353637DEFPARAM CUMULATEORDERS = FALSEDEFPARAM FLATAFTER = 205500// One Trade Per DayOnce nbTrades = 0Once tradesPerDay = 1If Day<>Day[1] thennbTrades = 0ElseIf (Not OnMarket[1] and OnMarket) xor (ShortOnMarket[1] and LongOnMarket) xor (LongOnMarket[1] and ShortOnMarket) thennbTrades = nbTrades + 1EndifEndifIf nbTrades < tradesPerDay then//End One Trade Per Day Codecashhigh = highest[180](high)cashlow = lowest[180](low)IF NOT LONGONMARKET AND Time > 173000 AND Time <= 193000 THEN//Enter LongsBUY 1 PERPOINT AT cashhigh-5 STOPset stop ploss 40set target pprofit 40ENDIF//Enter ShortsIF NOT SHORTONMARKET AND Time > 173000 AND Time <= 193000 THENSELLSHORT 1 PERPOINT at cashlow+5 STOPset stop ploss 20set target pprofit 20ENDIFENDIF05/26/2016 at 3:09 PM #815205/26/2016 at 3:22 PM #8154Could be this ?
12345678910111213141516IF Time > 173000 AND Time <= 193000 THEN//Enter LongsIF NOT LONGONMARKET THENBUY 1 PERPOINT AT cashhigh-5 STOPset stop ploss 40set target pprofit 40ENDIF//Enter ShortsIF NOT SHORTONMARKETSELLSHORT 1 PERPOINT at cashlow+5 STOPset stop ploss 20set target pprofit 20ENDIFENDIF05/26/2016 at 3:26 PM #815505/26/2016 at 3:37 PM #8158Ok, how about this?
123456789101112131415161718192021222324252627282930IF Time > 173000 AND Time <= 193000 THEN//Enter LongsIF NOT LONGONMARKET THENBUY 1 PERPOINT AT cashhigh-5 STOPstoplong = cashhigh-45*pipsizeprofitlong = cashhigh+55*pipsizeENDIF//Enter ShortsIF NOT SHORTONMARKETSELLSHORT 1 PERPOINT at cashlow+5 STOPstopshort = cashlow-15*pipsizeprofitshort = cashlow+25*pipsizeENDIFENDIFIF NOT ONMARKET THENstoplong = 0stopshort = 0profitlong = 0profitshort = 0ENDIFIF LONGONMARKET THENsell at stoplong stopsell at profitlong limitENDIFIF SHORTONMARKET THENexitshort at stopshort stopexitshort at profitshort limitENDIF05/26/2016 at 3:57 PM #8161Thanks again but not working, no stops or limits work at all… All other code works. All trades close at the FLATAFTER time…
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061DEFPARAM CUMULATEORDERS = FALSEDEFPARAM FLATAFTER = 205500//One Trade Per DayOnce nbTrades = 0Once tradesPerDay = 1If Day<>Day[1] thennbTrades = 0ElseIf (Not OnMarket[1] and OnMarket) xor (ShortOnMarket[1] and LongOnMarket) xor (LongOnMarket[1] and ShortOnMarket) thennbTrades = nbTrades + 1EndifEndifIf nbTrades < tradesPerDay then//End One Trade Per Day CodeIF Time = 173000 thencashhigh = highest[180](high)cashlow = lowest[180](low)ENDIFIF Time > 173000 AND Time <= 193000 THEN//Enter LongsIF NOT LONGONMARKET THENBUY 1 PERPOINT AT cashhigh-5 STOPstoplong = cashhigh-40*pipsizeprofitlong = cashhigh+40*pipsizeENDIF//Enter ShortsIF NOT SHORTONMARKET THENSELLSHORT 1 PERPOINT at cashlow+5 STOPstopshort = cashlow-20*pipsizeprofitshort = cashlow+20*pipsizeENDIFENDIFIF LONGONMARKET THENsell at stoplong stopsell at profitlong limitENDIFIF SHORTONMARKET THENsell at stopshort stopsell at profitshort limitENDIFIF NOT ONMARKET THENstoplong = 0stopshort = 0profitlong = 0profitshort = 0ENDIFENDIF -
AuthorPosts
Find exclusive trading pro-tools on