Request help coding strategy with RSI 2
Forums › ProRealTime English forum › ProOrder support › Request help coding strategy with RSI 2
- This topic has 6 replies, 2 voices, and was last updated 7 years ago by johnolofs.
-
-
07/07/2017 at 4:08 PM #40037
Hey,
I wonder if some one could help im trying to get MA 61 crossing 200 in bulltrend, and i also want in this bulltrend to have and RSI 2 that picks up a contract as it goes down to the value of 6 and sell the position when it hits the value of 95. The only thing i cant get to work is that i only want the RSI to react when the 61 have crossed over 200. So the RSI have to be depended of it self and also sync with the MA. So of when MA have been taken out of profit or MA been crossing under, then i dont want RSI to take any more positions until MA 61 is crossing 200 again. Just then does the RSI have acces to buy again.
Do i make sense?
Thank you, hope som of you guys can help me.
07/10/2017 at 9:31 AM #4020607/10/2017 at 12:43 PM #40235Hey, want in bullish trend that 1 long position triggered with MA is crossing and i also want under this positions of MA that the RSI2 starts buying multiple of times every time it is under level 6 in this bullish trend. So i get 1 long position and maybe in i get 5-10 more trades depending of the value of rsi2.
This is so far i have gotten and now the rsi buys all the time both in bullish and bear.
12345678910111213141516171819202122232425262728293031323334353637383940414243//-------------------------------------------------------------------------//-------------------------------------------------------------------------// Definition of code parametersDEFPARAM CumulateOrders = true // Cumulating positions deactivated//DEFPARAM FlatBefore = 080000//DEFPARAM FlatAfter = 223000//KÖPID2 = average[30]ID3 = average[80]ID0 = RSI[2]if b3 thenbuy 1 contract at marketendifb2 = (ID2 crosses over ID3)b3 = (ID0 <6)IF b2 THENBUY 1 CONTRACT AT MARKETENDIF//SÄLJID4 = average[30]ID5 = average[80]ID6 = RSI[2]s1 = (ID4 crosses under ID5)s2 = (ID6 >90)if s2 thensell at marketendifIF s1 THENSell at marketendif07/10/2017 at 12:52 PM #40237> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
Code is read from top to bottom and your line 19 is below the line 14, which has no sense, because you are testing something that still don’t exist at line 14 (b3 is nothing at that moment).
I modified the code the way I understand your strategy :
1234567891011121314151617181920212223242526//-------------------------------------------------------------------------//-------------------------------------------------------------------------// Definition of code parametersDEFPARAM CumulateOrders = true // Cumulating positions activated//DEFPARAM FlatBefore = 080000//DEFPARAM FlatAfter = 223000//KÖPMA30 = average[30]MA80 = average[80]ID0 = RSI[2]b1 = (MA30 crosses over MA80)b2 = (ID0 crosses under 6)if b1 or b2 thenbuy 1 contract at marketendif//SÄLJs1 = (MA30 crosses under MA80)s2 = (ID0 > 90)if s1 or s2 thensell at marketendif(not tested, please make your own tests and give feedback here).
07/10/2017 at 1:31 PM #40241Hey and thank you, yes i will use the “insert code prt” from here on.
The code is still buying in bull and bear, i will add three pictures and trying to explain myself.
The third picture i am trying to show you how i want it to buy. The circle should be the long position in this bull trend. Then i have put out som green arrows in the rsi that i want to buy in the “dips” but only this can be done when the ma is in bull.
Thanks
07/10/2017 at 2:44 PM #40259OH SORRY, just change to code to this one instead:
123456789101112131415161718192021222324252627//-------------------------------------------------------------------------//-------------------------------------------------------------------------// Definition of code parametersDEFPARAM CumulateOrders = true // Cumulating positions activated//DEFPARAM FlatBefore = 080000//DEFPARAM FlatAfter = 223000//KÖPMA30 = average[30]MA80 = average[80]ID0 = RSI[2]b1 = (MA30 crosses over MA80)b2 = (ID0 crosses under 6)b3 = MA30>MA80if (b1 or b2) and b3 thenbuy 1 contract at marketendif//SÄLJs1 = (MA30 crosses under MA80)s2 = (ID0 > 90)if s1 or s2 thensell at marketendifYou should change the “6” level of the RSI, because it is not reaching this level in your example (I ran test myself).
07/10/2017 at 5:15 PM #40278Hey again, thank you very much sir. Now the code is exactly how i want it. Perfect! And i also understand now how to write other codes thanks to this. I will now backtest with som new and other values.
I appreciate this very much.
I will report back how its going.
-
AuthorPosts
Find exclusive trading pro-tools on