RSI and IBS based EA
Forums › ProRealTime English forum › ProOrder support › RSI and IBS based EA
- This topic has 9 replies, 4 voices, and was last updated 7 years ago by
Marc.
-
-
11/23/2017 at 11:59 AM #53719
Hi together,
I’d like to share my code with you and want to know if there is any mistake within this code?
Thank you in advanceHere are the rules for this system:
Enter Long when:- When RSI with Period 2 is below or equal 10 on previous periods close
- When RSI with Period 2 is above or equal 10 at close of current periods close
- When IBS is below or equal 50 on previous periods close
- When IBS is above or equal 50 at close of current period
- Open Long at next bar open
Exit Long when:
- RSI rises above 80 at close of previous period, close position at next bar open
Enter Short when:
- When RSI with Period 2 is above or equal 90 on previous periods close
- When RSI with Period 2 is below or equal 90 at close of current periods close
- When IBS is above or equal 50 on previous periods close
- When IBS is below or equal 50 at close of current period
- Open Short at next bar open
Exit Short when:
- RSI falls below 20 at close of previous period, close position at next bar open
Here is the code:
1234567891011//INDICATORIBS = (Close-Low) / (HIGH-LOW) * 100RSI2 = RSI[2](close)//SIGNALIBSLONGTRIGGER = 50IBSSHORTTRIGGER = 50RSILONGTRIGGER = 10RSILONGEXIT = 80RSISHORTTRIGGER = 90RSISHORTEXIT = 20//ENTRY CONDITIONl1 = not LongOnMarketl1 = l1 and IBS[1] >= IBSLONGTRIGGER[1]l1 = l1 and IBS[2] <= IBSLONGTRIGGER[2]l1 = l1 and RSI2[1] >= RSILONGTRIGGER[1]l1 = l1 and RSI2[2] <= RSILONGTRIGGER[2]b1 = not ShortOnMarketb1 = b1 and IBS[1] <= IBSSHORTTRIGGER[1]b1 = b1 and IBS[2]>= IBSSHORTTRIGGER[2]b1 = b1 and RSI2[1] <= RSISHORTTRIGGER[1]b1 = b1 and RSI2[2] >= RSISHORTTRIGGER[2]//EXIT CONDITIONl2 = LongOnMarketl2 = l2 and RSI2[1] >= RSILONGEXIT[1]b2 = ShortOnMarketb2 = b2 and RSI2[1] <= RSISHORTEXIT[1]//LONG ENTRYIF l1 THENBUY 1 CONTRACTS AT MARKET NextBarOpenENDIF//LONG EXITIf l2 THENSELL AT MARKET NextBarOpenENDIF//SHORT ENRTRYIF b1 THENSELLSHORT 1 CONTRACTS AT MARKET NextBarOpenENDIF//SHORT EXITIF b2 THENEXITSHORT AT MARKET NextBarOpenENDIF11/23/2017 at 2:02 PM #537331234l1 = l1 and IBS >= IBSLONGTRIGGERl1 = l1 and IBS[1] <= IBSLONGTRIGGER[1]l1 = l1 and RSI2 >= RSILONGTRIGGERl1 = l1 and RSI2[1] <= RSILONGTRIGGER[1]You should use [1] for previous period and no additional number for current period.
1 user thanked author for this post.
11/23/2017 at 2:28 PM #537351234l1 = l1 and IBS >= IBSLONGTRIGGERl1 = l1 and IBS[1] <= IBSLONGTRIGGER[1]l1 = l1 and RSI2 >= RSILONGTRIGGERl1 = l1 and RSI2[1] <= RSILONGTRIGGER[1]You should use [1] for previous period and no additional number for current period.
Hi victormork,
thank you very much for your help.
Currently I’m testing this system manual und hope that this will work constantly on other timeframes…
To enter additional Orders when entry rules are met here is the amended code:123456789101112//INDICATORIBS = (Close-Low) / (HIGH-LOW) * 100RSI2 = RSI[2](close)//SIGNALIBSLONGTRIGGER = 50IBSSHORTTRIGGER = 50RSILONGTRIGGER = 10RSILONGEXIT = 80RSISHORTTRIGGER = 90RSISHORTEXIT = 20//ENTRY CONDITIONl1 = IBS >= IBSLONGTRIGGERl1 = l1 and IBS[1] <= IBSLONGTRIGGER[1]l1 = l1 and RSI2 >= RSILONGTRIGGERl1 = l1 and RSI2[1] <= RSILONGTRIGGER[1]b1 = IBS <= IBSSHORTTRIGGERb1 = b1 and IBS[1]>= IBSSHORTTRIGGER[1]b1 = b1 and RSI2 <= RSISHORTTRIGGERb1 = b1 and RSI2[1] >= RSISHORTTRIGGER[1]//EXIT CONDITIONl2 = LongOnMarketl2 = l2 and RSI2[1] > RSILONGEXIT[1]b2 = ShortOnMarketb2 = b2 and RSI2[1] < RSISHORTEXIT[1]//LONG ENTRYIF l1 THENBUY 1 CONTRACTS AT MARKET NextBarOpenENDIF//LONG EXITIf l2 THENSELL AT MARKET NextBarOpenENDIF//SHORT ENRTRYIF b1 THENSELLSHORT 1 CONTRACTS AT MARKET NextBarOpenENDIF//SHORT EXITIF b2 THENEXITSHORT AT MARKET NextBarOpenENDIF11/23/2017 at 3:19 PM #53736another improvement:
123456789101112//INDICATORIBS = (Close-Low) / (HIGH-LOW) * 100RSI2 = RSI[2](close)//CONTRACTSIZEX = 3//SIGNALIBSLONGTRIGGER = 50IBSSHORTTRIGGER = 50RSILONGTRIGGER = 10RSILONGEXIT = 80RSISHORTTRIGGER = 90RSISHORTEXIT = 20//ENTRY CONDITIONl1 = NOT LongOnMarketl1 = IBS >= IBSLONGTRIGGERl1 = l1 and IBS[1] <= IBSLONGTRIGGER[1]l1 = l1 and RSI2 >= RSILONGTRIGGERl1 = l1 and RSI2[1] <= RSILONGTRIGGER[1]b1 = NOT ShortOnMarketb1 = IBS <= IBSSHORTTRIGGERb1 = b1 and IBS[1]>= IBSSHORTTRIGGER[1]b1 = b1 and RSI2 <= RSISHORTTRIGGERb1 = b1 and RSI2[1] >= RSISHORTTRIGGER[1]//EXIT CONDITIONl2 = LongOnMarketl2 = RSI2 > RSILONGEXITb2 = ShortOnMarketb2 = RSI2 < RSISHORTEXIT//LONG ENTRYIF l1 THENBUY X CONTRACTS AT MARKET NextBarOpenENDIF//LONG EXITIf l2 THENSELL X CONTRACTS AT MARKET NextBarOpenENDIF//SHORT ENTRYIF b1 THENSELLSHORT X CONTRACTS AT MARKET NextBarOpenENDIF//SHORT EXITIF b2 THENEXITSHORT AT MARKET NextBarOpenENDIF11/23/2017 at 4:31 PM #53741Now with MA as filter….
1234567891011121314151617181920212223242526272829303132333435363738394041424344INDICATORIBS = (Close-Low) / (HIGH-LOW) * 100RSI2 = RSI[2](close)MA = average[maperiod](close)CONTRACTSIZEX = 10//MOVING AVERAGE PERIODmaperiod = 144SIGNALIBSLONGTRIGGER = 50IBSSHORTTRIGGER = 50RSILONGTRIGGER = 10RSILONGEXIT = 80RSISHORTTRIGGER = 90RSISHORTEXIT = 20//ENTRY CONDITIONl1 = NOT LongOnMarketl1 = l1 and IBS > IBSLONGTRIGGERl1 = IBS[1] < IBSLONGTRIGGER[1]l1 = l1 and RSI2 > RSILONGTRIGGERl1 = RSI2[1] < RSILONGTRIGGER[1]l1 = l1 and low[1] > MAb1 = NOT ShortOnMarketb1 = b1 and IBS < IBSSHORTTRIGGERb1 = IBS[1] > IBSSHORTTRIGGER[1]b1 = b1 and RSI2 < RSISHORTTRIGGERb1 = RSI2[1] > RSISHORTTRIGGER[1]b1 = b1 and high [1] < MA//EXIT CONDITIONl2 = LongOnMarketl2 = RSI2 > RSILONGEXITb2 = ShortOnMarketb2 = RSI2 < RSISHORTEXIT//LONG ENTRYIF l1 THENBUY X CONTRACTS AT MARKET NextBarOpenENDIF//LONG EXITIf l2 THENSELL X CONTRACTS AT MARKET NextBarOpenENDIF//SHORT ENTRYIF b1 THENSELLSHORT X CONTRACTS AT MARKET NextBarOpenENDIF//SHORT EXITIF b2 THENEXITSHORT AT MARKET NextBarOpenENDIF11/24/2017 at 8:51 AM #53796What timeframe and what market are you planning this strategy on?
Interesting results but i would definitly use12// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivatedIf not youre getting an INSANE amount of trades 😛 Even without that its basicly in the market at all times. With 5 min timeframe on the dax i get an avg 18 trades pr day hehe.Its not that crazy bad though, 6258 trades in totalt (INSANE and not very good imo) 4000 wins and 2000 loss. Should indicate that its either superlucky, or actually might have a decent entry 🙂
11/24/2017 at 8:59 AM #53797Hi,
>> For clarity of messages on ProRealCode’s forums, please use the “<> (insert PRT code)” button in the message editor to separate the text part from the code part! Thank you! <<
1 user thanked author for this post.
11/24/2017 at 12:12 PM #53842What timeframe and what market are you planning this strategy on? Interesting results but i would definitly use // Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated If not youre getting an INSANE amount of trades
Even without that its basicly in the market at all times. With 5 min timeframe on the dax i get an avg 18 trades pr day hehe. Its not that crazy bad though, 6258 trades in totalt (INSANE and not very good imo) 4000 wins and 2000 loss. Should indicate that its either superlucky, or actually might have a decent entry
Hi Jebus89,
the timeframes I’d use are 1H, 2H, 4H and Daily.
Thanks for your information regarding DEFPARAM. This makes it much more easier than to amend the parameters within the code.
How were the statistics in the test you made?
RSI IBS1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162DEFPARAM CumulateOrders = True//INDICATORIBS = (Close-Low) / (HIGH-LOW) * 100RSI2 = RSI[2](close)MA = average[maperiod](close)//CONTRACTSIZEX = 1//MOVING AVERAGE PERIODmaperiod = 200//SIGNALIBSLONGTRIGGER = 50IBSSHORTTRIGGER = 50RSILONGTRIGGER = 10RSILONGEXIT = 80RSISHORTTRIGGER = 90RSISHORTEXIT = 20//ENTRY CONDITIONl1 = NOT LongOnMarketl1 = l1 and IBS > IBSLONGTRIGGERl1 = IBS[1] < IBSLONGTRIGGER[1]l1 = l1 and RSI2 > RSILONGTRIGGERl1 = RSI2[1] < RSILONGTRIGGER[1]l1 = l1 and low[1] > MAb1 = NOT ShortOnMarketb1 = b1 and IBS < IBSSHORTTRIGGERb1 = IBS[1] > IBSSHORTTRIGGER[1]b1 = b1 and RSI2 < RSISHORTTRIGGERb1 = RSI2[1] > RSISHORTTRIGGER[1]b1 = b1 and high [1] < MA//EXIT CONDITIONl2 = LongOnMarketl2 = RSI2 > RSILONGEXITb2 = ShortOnMarketb2 = RSI2 < RSISHORTEXIT//LONG ENTRYIF l1 THENBUY X CONTRACTS AT MARKET NextBarOpenENDIF//LONG EXITIf l2 THENSELL X CONTRACTS AT MARKET NextBarOpenENDIF//SHORT ENTRYIF b1 THENSELLSHORT X CONTRACTS AT MARKET NextBarOpenENDIF//SHORT EXITIF b2 THENEXITSHORT AT MARKET NextBarOpenENDIF11/24/2017 at 2:42 PM #53860CumulateOrders = True? Should it not be set to false? You wanted 1 position only right?
11/24/2017 at 4:02 PM #53865 -
AuthorPosts
Find exclusive trading pro-tools on