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

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.


    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 arvidvanstaey, Today, 02:19 PM
      4 responses
      11 views
      0 likes
      Last Post arvidvanstaey  
      Started by samish18, 04-17-2024, 08:57 AM
      16 responses
      61 views
      0 likes
      Last Post samish18  
      Started by jordanq2, Today, 03:10 PM
      2 responses
      9 views
      0 likes
      Last Post jordanq2  
      Started by traderqz, Today, 12:06 AM
      10 responses
      18 views
      0 likes
      Last Post traderqz  
      Started by algospoke, 04-17-2024, 06:40 PM
      5 responses
      48 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X