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

Problem with multitimeframe strategy

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

    Problem with multitimeframe strategy

    I found my error, excuse me.
    You can erase this message if you want.

    Thank's a lot.


    Good morning,
    I test a MTF strategy (5/60 min) and I have a problem.
    I explain exit strategy:
    The system must exit the order when the close of hour candle is superior at the EMA 10 hour.
    The system work with 2 time frame 5 and 60 min.
    My code is:
    protected override void Initialize()
    {
    Add(Instrument.FullName,PeriodType.Minute, 60,MarketDataType.Bid);

    CalculateOnBarClose = true;
    }
    After:
    protected override void OnBarUpdate()
    {
    if(BarsInProgress==1)
    {
    ema10hour=EMA(Close,maCourteLenght)[0];
    }

    //exit condition
    if(BarsInProgress==1)
    {
    if(Position.MarketPosition == MarketPosition.Short && CrossAbove(Close,ema10hour,1))
    ExitShort("CS2", "S");
    }
    }

    The system exit me well but not at the good price like you see in the joint picture. The price whose take by the statment is the price of the EMA and it should take the close price.

    Thank's for your help.
    Attached Files
    Last edited by neo-13; 01-21-2013, 12:05 PM.

    #2
    Thanks for the update Neo, we're glad to hear you could isolate and resolve. All the best.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Kraken29, Today, 12:32 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by codeowl, 02-11-2019, 05:47 AM
    23 responses
    678 views
    0 likes
    Last Post stockbux  
    Started by arangocj, Today, 12:37 PM
    0 responses
    10 views
    0 likes
    Last Post arangocj  
    Started by joselube001, Today, 12:17 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by marcus2300, Today, 10:21 AM
    5 responses
    13 views
    0 likes
    Last Post RaddiFX
    by RaddiFX
     
    Working...
    X