Help for modify long position for short position
Forums › ProRealTime English forum › ProOrder support › Help for modify long position for short position
- This topic has 6 replies, 3 voices, and was last updated 5 years ago by onoisukaaa.
-
-
06/19/2018 at 5:03 AM #73616
Hello i need some help for modify existing algo made by Wilko.
Curent algo take only Long postion and i want modify for taking both.
Original code (only buy ):
original code12345678910111213141516171819202122232425ShortRSI = RSI[2](close)LongRSI = RSI[30](close) //1 month RSIMA = Average[22,0](close) //1 month moving average of closeSlope = MA/MA[1]-1 //Slope of 1 month moving averageMaxPos = 1 //Set to tolerated maximum positionLongEntry = CountOfLongShares < MaxPos //Buy until MaxPos reachedLongEntry = LongEntry AND ShortRSI < 15 //Buy when RSI2 below 15LongEntry = LongEntry AND LongRSI > 50 //Filter for 1month RSI above 50LongEntry = LongEntry AND Slope > 0 //Filter for positive slope of MA22LongExit = LongOnMarketLongExit = LongExit AND ShortRSI > 60 //Exit position when RSI2 above 60// Conditions to enter long positionsIF LongEntry THENBUY 2 CONTRACTS AT MARKETENDIF// Conditions to exit long positionsIF LongExit THENSELL AT MARKETENDIFMy (bad )modification for short :
12345678910111213141516171819202122232425ShortRSI = RSI[2](close)LongRSI = RSI[30](close) //1 month RSIMA = Average[22,0](close) //1 month moving average of closeSlope = MA/MA[1]-1 //Slope of 1 month moving averageMaxPos = 2 //Set to tolerated maximum positionShortEntry = CountOfShortShares < MaxPos //Buy until MaxPos reachedShortEntry = ShortEntry AND ShortRSI > 60 //Short when RSI2 above 60ShortEntry = ShortEntry AND LongRSI < 50 //Filter for 1month RSI below 50ShortEntry = ShortEntry AND Slope > 0 //Filter for positive slope of MA22ShortExit = ShortOnMarketShortExit = ShortExit AND ShortRSI < 15 //Exit position when RSI2 below 15// Conditions to enter short positionsIF ShortEntry THENSELL 2 CONTRACTS AT MARKETENDIF// Conditions to exit short positionsIF ShortExit THENBUY AT MARKETENDIFWith my modification when i backtest i have zero results
Thanks for your helps
06/19/2018 at 6:08 AM #73619At first look the BUY and SELL instructions that you use are the wrong ones. You need to use SELLSHORT and EXITSHORT for short position entry and exit. BUY and SELL are for long positions only.
123456789// Conditions to enter short positionsIF ShortEntry THENSellShort 2 CONTRACTS AT MARKETENDIF// Conditions to exit short positionsIF ShortExit THENExitShort AT MARKETENDIF06/19/2018 at 8:02 AM #7364406/19/2018 at 9:53 AM #7365606/19/2018 at 2:47 PM #73674Sorry for jumping in Vonasi
Jump in all you like GraHal. I’ve been out enjoying myself sailing in the rain. Rain in Greece in June! …..and Trump says there is no global warming!
1 user thanked author for this post.
06/19/2018 at 2:51 PM #73675Your short code was fine. It is just that:
1234BUY // Used to open a long position.SELL // Used to close a long positionSELLSHORT // Used to open a short positionEXITSHORT // Used to close a short positionSo your code would be:
12345678910111213141516171819202122232425ShortRSI = RSI[2](close)LongRSI = RSI[30](close) //1 month RSIMA = Average[22,0](close) //1 month moving average of closeSlope = MA/MA[1]-1 //Slope of 1 month moving averageMaxPos = 2 //Set to tolerated maximum positionShortEntry = CountOfShortShares < MaxPos //Buy until MaxPos reachedShortEntry = ShortEntry AND ShortRSI > 60 //Short when RSI2 above 60ShortEntry = ShortEntry AND LongRSI < 50 //Filter for 1month RSI below 50ShortEntry = ShortEntry AND Slope > 0 //Filter for positive slope of MA22ShortExit = ShortOnMarketShortExit = ShortExit AND ShortRSI < 15 //Exit position when RSI2 below 15// Conditions to enter short positionsIF ShortEntry THENSELLSHORT 2 CONTRACTS AT MARKETENDIF// Conditions to exit short positionsIF ShortExit THENEXITSHORT AT MARKETENDIF06/19/2018 at 3:42 PM #73679 -
AuthorPosts
Find exclusive trading pro-tools on