Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MultiTimeFrame Condition not working

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

    MultiTimeFrame Condition not working

    Hello,

    I am trying to create a condition in which it takes a price from a timeframe and submits an order once the price in a different timeframe crosses below. I think the code is good but it does not submit the order. (It does not annunciate any error)

    else if (State == State.Configure)
    {

    // Add a 45 minute Bars object to the strategy
    AddDataSeries(Data.BarsPeriodType.Minute, 1); // BarsArray[1]

    AddDataSeries(Data.BarsPeriodType.Second, 1); // BarsArray[2]
    }


    protected override void OnBarUpdate()
    {
    if ( TimeToTrade() && barNumberOfLongEntries == 0 && okToEnter )
    {
    if (LongSignal())
    {

    precioentrada2 = Close[0] - (Convert.ToInt32(Order02Offset) * TickSize); Print("precioentrada2 " +precioentrada2);

    CancelOpenEntries();
    CancelOpenOrders();
    barNumberOfLongEntries = CurrentBar;

    escalondos = 1;



    if (CrossBelow(Closes[2], (precioentrada2 - 5 * TickSize), 1) && CurrentBar < barNumberOfLongEntries + OrderActiveBars && escalondos > 0) //THIS IS THE PART NOT WORKING
    {
    EnterLongStopMarket(0, true, Convert.ToInt32(Order02LotSize), precioentrada2, "LE02"); Print("order 2 " +precioentrada2);
    escalondos = 0;
    }
    }
    }

    #2
    Hello Jorge.andres.o,

    To understand why the condition is not evaluating as true, print the values used in the condition to the output window.

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.
    https://ninjatrader.com/support/foru...121#post791121

    Print the time, print the value of Closes[2][1] and Closes[2][0], print all of the other values used in the condition.

    Save the output from the output window to a text file and provide this with your reply.
    I'll be happy to assist with analyzing the output.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea. i will work on it

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ntbone, Yesterday, 10:31 PM
      2 responses
      16 views
      0 likes
      Last Post ntbone
      by ntbone
       
      Started by 7robert, Yesterday, 11:38 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Started by dpolyakov, Yesterday, 09:58 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by Rainmakersg, Today, 12:34 AM
      0 responses
      5 views
      0 likes
      Last Post Rainmakersg  
      Started by Bidder, Yesterday, 09:07 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Jason  
      Working...
      X