Cross Over Strategy HELP please
Forums › ProRealTime English forum › ProOrder support › Cross Over Strategy HELP please
- This topic has 22 replies, 2 voices, and was last updated 6 years ago by crolakstrading.
-
-
01/31/2018 at 5:30 PM #61121
Hi Roberto,
its me again to bother you! 🙂
I have been testing this manually and also try to create a strategy so i managed to get below ,i got this and try to change this from the forum but i really don’t know how to get the entry at 5pips above and below according to the indicator when the cross over happen.
is this something you can help out?
the numbers are just numbers.. i mean SL and targets etc.. hoping i can change this change!!
Many Thanks
Ro
1234567891011121314151617181920212223242526272829303132// Conditions to enter long positionsi1 = exponentialaverage[9](close)i2 = exponentialaverage[40](close)long = i1 crosses over i2short = i1 crosses under i2IF NOT LongOnMarket AND long THENBUY 1 CONTRACTS AT MARKETENDIF// Conditions to exit long positionsIf LongOnMarket AND short THENSELL AT MARKETENDIF// Conditions to enter short positionsIF NOT ShortOnMarket AND short THENSELLSHORT 1 CONTRACTS AT MARKETENDIF// Conditions to exit short positionsIF ShortOnMarket AND long THENEXITSHORT AT MARKETENDIF// Stops and targets : Enter your protection stops and profit targets here// points based STOP LOSS and TRAILING STOP// initial STOP LOSSSET STOP pLOSS 30// trailing stopSET STOP pTRAILING 2001/31/2018 at 5:32 PM #61123please if you can add up and correct me, really appreciated!!
01/31/2018 at 5:49 PM #61127I’ll take a look at your code tomorrow.
1 user thanked author for this post.
01/31/2018 at 5:59 PM #61129Thank you @robertogozzi
02/01/2018 at 12:27 AM #61158Since you are now talking about a strategy I just moved the topic to ProOrder support.
Back tomorrow for hints.
02/01/2018 at 11:43 AM #61189You only have to change lines 8 and 18 as follows
12BUY 1 CONTRACTS AT close + (5 * pipsize) LIMITSELLSHORT 1 CONTRACTS AT close - (5 * pipsize) LIMITbut, since a LIMIT/STOP order expires when the candle closes, do you want to place it again through the following candles? If yes, till when, maybe till the opposite crossing happens?
Also, replacing LIMIT with STOP would do better, I guess.
02/01/2018 at 12:43 PM #61196Thanks for this..for some reason it say this cannot be added because trailing stop are not enabled in my account..
I have removed the trailing stop.
just to make sure will this wait for 5bars then take the 5pips above or below highs/ lows as an entry?
IF CrossOver[5] THEN
IF summation[4](CrossOver OR CrossUnder) = 0 THENTopLine = highest[5](high) + (5 * pipsize)how can we replace LIMIT with STOP?
1234567891011121314151617181920212223242526272829// Conditions to enter long positionsi1 = exponentialaverage[9](close)i2 = exponentialaverage[40](close)long = i1 crosses over i2short = i1 crosses under i2IF NOT LongOnMarket AND long THENBUY 1 CONTRACTS AT close + (5 * pipsize) LIMITENDIF// Conditions to exit long positionsIf LongOnMarket AND short THENSELL AT MARKETENDIF// Conditions to enter short positionsIF NOT ShortOnMarket AND short THENSELLSHORT 1 CONTRACTS AT close - (5 * pipsize) LIMITENDIF// Conditions to exit short positionsIF ShortOnMarket AND long THENEXITSHORT AT MARKETENDIF// Stops and targets : Enter your protection stops and profit targets here// points based STOP LOSS and TRAILING STOP// initial STOP LOSSSET STOP pLOSS 3002/01/2018 at 4:00 PM #61203not sure what you mean by replacing LIMIT with STOP?
another way is let say when its move 20pip on profit stop to break even!!!
02/01/2018 at 4:20 PM #61206Yes, your lines should do good.
As for your stops I don’t know about your limits with IG, but I want to point out that, despite examples in the PRT manual, the first one (SET STOP pLOSS 30) would be overridden by the second one (SET STOP pTRAILING 20), since they cannot be set together.
not sure what you mean by replacing LIMIT with STOP?
LIMIT guarantees execution only at the price you decided (or a most favourable one) and is used when you BUY at a lower price or SELLSHORT at a higher one, while STOP guarantees execution no matter what price (provided the price you decided is reached) and is used when you BUY at a higher price or SELLSHORT at a lower one.
02/01/2018 at 4:45 PM #61207ahh ok.. its a better idea! 🙂 where should i change?
is possible to make the stop loss to Break even once its reach to a certain point too?
02/01/2018 at 5:19 PM #61210As for Breakeven you should read, merge into your code and experiment with Nicols’ code (https://www.prorealcode.com/blog/learning/breakeven-code-automated-trading-strategy/).
If you search Breakeven in the forum you’ll find plenty of code to to use and learn from.
I modified the BUY/SELLSHORT lines to accomodate for an evaluation of price, to check whether EntryPrice is more favourable (in order to use LIMIT) or not (in order to use STOP):
123456789101112131415161718192021222324252627282930313233343536373839// Conditions to enter long positionsi1 = exponentialaverage[9](close)i2 = exponentialaverage[40](close)long = i1 crosses over i2short = i1 crosses under i2IF NOT LongOnMarket AND long THENEntryPrice = close + (5 * pipsize)IF EntryPrice < close THENBUY 1 CONTRACTS AT EntryPrice LIMITELSEBUY 1 CONTRACTS AT EntryPrice STOPENDIFENDIF// Conditions to exit long positionsIf LongOnMarket AND short THENSELL AT MARKETENDIF// Conditions to enter short positionsIF NOT ShortOnMarket AND short THENEntryPrice = close - (5 * pipsize)IF EntryPrice > close THENSELLSHORT 1 CONTRACTS AT EntryPrice LIMITELSESELLSHORT 1 CONTRACTS AT EntryPrice STOPENDIFENDIF// Conditions to exit short positionsIF ShortOnMarket AND long THENEXITSHORT AT MARKETENDIF// Stops and targets : Enter your protection stops and profit targets here// points based STOP LOSS and TRAILING STOP// initial STOP LOSSSET STOP pLOSS 3002/01/2018 at 5:37 PM #61211Thanks very much!! for the link too… will do some more testing to find a better way!!
02/05/2018 at 11:08 AM #61535Hi Roberto,
As i have been testing this past few days.. i think the best entry is the STOP. as its more like a breakout! it didnt give e the right entry according to the indicator? as the for the indicator TOPLINE or the Bottomline
if TOPLINE that should be the proper entry:
1234IF CrossUnder[5] THENIF summation[4](CrossOver OR CrossUnder) = 0 THENBottomLine = lowest[5](low) - (5 * pipsize)DRAWTEXT("---#BottomLine#---",barindex-3,BottomLine,SansSerif,Bold,16)coloured(153,0,0)so i have managed to change this as below, and it gives the entry according to the indicator1234IF NOT LongOnMarket AND long[5] THENEntryPrice = highest[5](high) + (5* pipsize)BUY 1 CONTRACTS AT EntryPrice STOPENDIFbut its only trigger on the the 5th candle.. if after the 5th candle if its go up and the original entryprice wont get triggered?? is there a way to change this?? once we get the entry price.. it gets trigger any next 10 canldes once we get the original enterprice?
full code below..
1234567891011121314151617181920212223242526272829303132// Conditions to enter long positionsi1 = exponentialaverage[9](close)i2 = exponentialaverage[40](close)long = i1 crosses over i2short = i1 crosses under i2IF NOT LongOnMarket AND long[5] THENEntryPrice = highest[5](high) + (5* pipsize)BUY 1 CONTRACTS AT EntryPrice STOPENDIF// Conditions to exit long positionsIf LongOnMarket AND short THENSELL AT MARKETENDIF// Conditions to enter short positionsIF NOT ShortOnMarket AND short[5] THENEntryPrice = lowest[5](low) - (5 * pipsize)SELLSHORT 1 CONTRACTS AT EntryPrice STOPENDIF// Conditions to exit short positionsIF ShortOnMarket AND long THENEXITSHORT AT MARKETENDIF// Stops and targets : Enter your protection stops and profit targets here// points based STOP LOSS and TRAILING STOP// initial STOP LOSSSET STOP pLOSS 3002/05/2018 at 11:45 AM #61538lets say the its going long.. once we get the enryprice 5 pip above etc (topline on the idicator) …and if it didnt get triggered on the 5th bar but it gets triggered on the 9th bar if it reach original entryprice?? please see attached pic!!!
02/06/2018 at 11:56 AM #61666i mean how can we get the exact ToplLine or the Bottomline as an entry according to the indicator.. and entry price will act as a stop order when ever the market reach the entry price?? seems very complicated.. but i tried 100 ways didnt really work out 🙁
-
AuthorPosts
Find exclusive trading pro-tools on