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/24/2016 at 2:25 PM #787605/24/2016 at 2:38 PM #787705/24/2016 at 3:19 PM #788505/24/2016 at 3:30 PM #7886
Ok, don’t be sorry, there is no stupid question 🙂
So, just add these instructions to your code:
12SET STOP PLOSS 25SET TARGET PPROFIT 25You can have a look at all the Probacktest/ProOrder instruction here in the prorealtime documentation: http://www.prorealcode.com/documentation/category/probacktest/ , if you need more assistance to program your trading strategy, or just ask!
05/24/2016 at 3:53 PM #788805/24/2016 at 4:10 PM #7889Ok so test if you are in long or short conditions and then set your different values like this:
123456789if longonmarket thenSET STOP PLOSS 25SET TARGET PPROFIT 25endifif shortonmarket thenSET STOP PLOSS 35SET TARGET PPROFIT 42endif05/24/2016 at 4:39 PM #789605/24/2016 at 4:51 PM #7899Still no dice?
1234567891011121314151617181920212223242526IF Time = 173000 thencashhigh = highest[180](high)cashlow = lowest[180](low)ENDIF//Enter LongsIF Time > 173000 AND Time <= 193000 THENBUY 1 PERPOINT AT cashhigh-5 STOPENDIF//Enter ShortsIF Time > 173000 AND Time <= 193000 THENSELLSHORT 1 PERPOINT at cashlow+5 STOPENDIFif longonmarket thenSET STOP PLOSS 40SET TARGET PPROFIT 25endifif shortonmarket thenSET STOP PLOSS 30SET TARGET PPROFIT 25endif05/24/2016 at 5:04 PM #790205/24/2016 at 5:38 PM #7903The major indices and it only takes one trade per day, sorry didn’t include that bit. Basically everything works the way I want it apart from the fact I can’t adjust the long and short, stop and limit separately.
I could of course separate the code in to long and short positions but would be nice to have it in one code.
05/24/2016 at 7:05 PM #791005/24/2016 at 7:34 PM #7914Sorry I have not been clear, been too long at the screen.
This is working the way I want it, just need to achieve separate stops and limits for long and short positions.
1234567891011121314151617181920212223242526272829303132333435363738394041DEFPARAM 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)ENDIF//Enter LongsIF Time > 173000 AND Time <= 193000 THENBUY 1 PERPOINT AT cashhigh-5 STOPENDIF//Enter ShortsIF Time > 173000 AND Time <= 193000 THENSELLSHORT 1 PERPOINT at cashlow+5 STOPENDIFset stop ploss 25set target pprofit 50//ENDIF below is to finish off the one trades per day code at the start.ENDIF05/25/2016 at 9:49 PM #804205/26/2016 at 12:41 AM #8050123456789101112131415161718192021222324252627282930313233343536373839404142434445464748DEFPARAM 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)ENDIF//Enter LongsIF Time > 173000 AND Time <= 193000 THENBUY 1 PERPOINT AT cashhigh-5 STOPENDIF//Enter ShortsIF Time > 173000 AND Time <= 193000 THENSELLSHORT 1 PERPOINT at cashlow+5 STOPENDIFif longonmarket thenset stop ploss 40set target pprofit 25endifif shortonmarket thenset stop ploss 30set target profit 25endif//ENDIF below is to finish off the one trades per day code at the start.ENDIF05/26/2016 at 7:47 AM #8057 -
AuthorPosts
Find exclusive trading pro-tools on