NexusFi: Find Your Edge


Home Menu

 





Avoiding re-entries


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one kevinkdog with 6 posts (1 thanks)
    2. looks_two Bodil with 5 posts (0 thanks)
    3. looks_3 StratOpt with 2 posts (1 thanks)
    4. looks_4 sptrader with 1 posts (1 thanks)
    1. trending_up 4,620 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 14 posts
    2. attach_file 1 attachments




 
Search this Thread

Avoiding re-entries

(login for full post details)
  #1 (permalink)
 
Bodil's Avatar
 Bodil 
Oslo, Norway
 
Experience: Advanced
Platform: TradeStation / MultiCharts
Trading: Forex / Futures
Posts: 26 since Aug 2012
Thanks Given: 5
Thanks Received: 0

Hi everybody.

I have a strategy where the entry logic is RSI > OverBought for long and RSI < OverSold. If I use "crosses over" and "crosses under" respectively, no trades are generated for some reason. If the price reaches my profit target or stoploss level and the condition is still true, the system takes a new entry. How can I avoid these re-entries? What I want to achieve is only one entry per new signal.

Thank you very much in advance!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Request for MACD with option to use different MAs for fa …
NinjaTrader
ISO Equity Curve Indicator
NinjaTrader
Volume profile TradeStation
EasyLanguage Programming
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
33 thanks
GFIs1 1 DAX trade per day journal
23 thanks
Supertradersams Thread Journal on NQ/MNQ
23 thanks
Deaddogs Stock Trading
19 thanks
Leaving CFD trading and learning futures
13 thanks

(login for full post details)
  #3 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,636 since Jul 2012
Thanks Given: 1,881
Thanks Received: 7,300



Bodil View Post
Hi everybody.

I have a strategy where the entry logic is RSI > OverBought for long and RSI < OverSold. If I use "crosses over" and "crosses under" respectively, no trades are generated for some reason. If the price reaches my profit target or stoploss level and the condition is still true, the system takes a new entry. How can I avoid these re-entries? What I want to achieve is only one entry per new signal.

Thank you very much in advance!

Crosses over and Crosses under should work. I bet there is something else hindering signals. Please post non-proprietary portions of your code, along with a chart showing what is wrong. Or, print out values of RSI, Oversold and Undersold after each bar, and see if the data shows cross over and cross under.

Follow me on Twitter Reply With Quote
The following user says Thank You to kevinkdog for this post:
(login for full post details)
  #4 (permalink)
 
Bodil's Avatar
 Bodil 
Oslo, Norway
 
Experience: Advanced
Platform: TradeStation / MultiCharts
Trading: Forex / Futures
Posts: 26 since Aug 2012
Thanks Given: 5
Thanks Received: 0

The code is very basic:

inputs:
Price( Close ),
Length( 14 ),
OverSold( 40 ),
OverBought( 60 );

variables:
RSI_Mod( 0 ),
Signal(0) ;

RSI_Mod = RSI( (c+h+l)/3, Length );


//Long Entry
If RSI_Mod crosses over OverBought
Then Buy ("LE-RSI") next bar at open limit;


//Short Entry
If RSI_Mod crosses under OverSold
Then SellShort ("SE-RSI") next bar at open limit;

Started this thread Reply With Quote
(login for full post details)
  #5 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,636 since Jul 2012
Thanks Given: 1,881
Thanks Received: 7,300


Bodil View Post
The code is very basic:

inputs:
Price( Close ),
Length( 14 ),
OverSold( 40 ),
OverBought( 60 );

variables:
RSI_Mod( 0 ),
Signal(0) ;

RSI_Mod = RSI( (c+h+l)/3, Length );


//Long Entry
If RSI_Mod crosses over OverBought
Then Buy ("LE-RSI") next bar at open limit;


//Short Entry
If RSI_Mod crosses under OverSold
Then SellShort ("SE-RSI") next bar at open limit;


Code looks good. Please show example of this not working as you expect.

Follow me on Twitter Reply With Quote
(login for full post details)
  #6 (permalink)
 
Bodil's Avatar
 Bodil 
Oslo, Norway
 
Experience: Advanced
Platform: TradeStation / MultiCharts
Trading: Forex / Futures
Posts: 26 since Aug 2012
Thanks Given: 5
Thanks Received: 0

If you look at the attached example, I would have expected the system to go long somewhere between 10.30 and 11.00. It does not.

Attached Thumbnails
Click image for larger version

Name:	audjpy ex.bmp
Views:	191
Size:	1.60 MB
ID:	130843  
Started this thread Reply With Quote
(login for full post details)
  #7 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,636 since Jul 2012
Thanks Given: 1,881
Thanks Received: 7,300

Here is your problem:

Then Buy ("LE-RSI") next bar at open limit;



This says to place a limit order to buy at the open of the current signal bar. So, if the price of the next bar never goes below the open of the signal bar, no fill will occur.

Maybe you want instead:

Then Buy ("LE-RSI") next bar at market;

Follow me on Twitter Reply With Quote
(login for full post details)
  #8 (permalink)
 
Bodil's Avatar
 Bodil 
Oslo, Norway
 
Experience: Advanced
Platform: TradeStation / MultiCharts
Trading: Forex / Futures
Posts: 26 since Aug 2012
Thanks Given: 5
Thanks Received: 0

OK. Thanks!

But is there a way to use limit orders instead of market orders? The spread is so big it eats the profits before you even enters the trade......

Also, if I should use the "larger than" respectively "smaller than" instead of crosses over/under: Is there a way I can avoid re-entries in the same direction on the same entry signal?

Started this thread Reply With Quote
(login for full post details)
  #9 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,636 since Jul 2012
Thanks Given: 1,881
Thanks Received: 7,300


Bodil View Post
OK. Thanks!

But is there a way to use limit orders instead of market orders? The spread is so big it eats the profits before you even enters the trade......

Also, if I should use the "larger than" respectively "smaller than" instead of crosses over/under: Is there a way I can avoid re-entries in the same direction on the same entry signal?


1. If the spread is so big, maybe you should not be trading it. Big spreads grind you down, even if you only have then on stop orders.

2. To take it a step further, ALL your test results with limit or stop orders are invalid. It is because you are only using bid data to evaluate your strategy. Quick example: Assume the bid hits your buy limit, but the ask doesn't. Your strategy will show a fill, but not the real world. Think about this for awhile - it is a critical point. SUPER critical.

3. Crosses above and under should work. For a cross above to be triggered, it has to cross below the same line. The logic will need to be different if you want to ensure long - short - long - short.

Follow me on Twitter Reply With Quote
(login for full post details)
  #10 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,636 since Jul 2012
Thanks Given: 1,881
Thanks Received: 7,300


Because of the reason I describe in point 2 above, when I do Forex development, I ONLY use market orders. No stop orders, no limit orders.

Of course, I work in Tradestation. Multicharts has an option to test with both bid and ask data, so limits and stops are probably OK there. I am not sure of Ninja.

Follow me on Twitter Reply With Quote





Last Updated on December 18, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts