Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    67 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    150 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    99 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    286 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X