Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Assistance with exit strategy using intra day data

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Assistance with exit strategy using intra day data

    I am struggling to achieve what seems like a relatively simple task:

    If yesterday's close is above EMA I want to enter long at the open and exit on the close of the same day.

    From what I gather I need to use intra day data. I have followed the example below:

    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


    But the problem I am getting is that the exit price is from the previous bars close rather than the current bars close.

    Any suggestions would be much appreciated.
    Attached Files

    #2
    Hello Beach01,

    Using the Strategy Analyzer it is going to process your Strategy with Calculate On Bar Close true, so that mean once all of your conditions are your Strategy is going to enter the market at the open of the next bar.

    With your Exit condition looking at a Minute Time-frame most instruments will have an overnight session that is going to be triggering to Exit your Position when you are not wanting it to. You may want to change your time frame between a time period so that you can better close out of your position before the new session starts for example:

    Code:
    if (enteredLong && 
         ToTime(Times[1][0]) <= 160000 && ToTime(Times[1][0]) >= 155500)	
    
    ExitLong();
    Let us know if that works better for you.
    JCNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DavidHP, Today, 07:56 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by kujista, Today, 06:23 AM
    3 responses
    6 views
    0 likes
    Last Post kujista
    by kujista
     
    Started by Mindset, Yesterday, 02:04 AM
    2 responses
    18 views
    0 likes
    Last Post NinjaTrader_RyanS  
    Started by f.saeidi, Today, 08:03 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by samish18, 04-17-2024, 08:57 AM
    15 responses
    53 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X