Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can you program OrderEntry commands in a loop or only in explicit code

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

  • NinjaTrader_AlanP
    replied
    Hello Vladja,

    Thank you for your note.

    On each loop the same order is going to submitted, as the signal name remains the same. To have a new order created on each loop, you would need to modify the signalName.

    One way you could do this would be to use a for loop, and pass i to the signalName, making it unique on each loop.
    Code:
    for(int i=0; i<3; i++)
     EnterLongStopMarket(Convert.ToInt32(DefaultQuantity), StopPrice, i.ToString()+StopPriceToString());
    Please let us know if you need further assistance.

    Leave a comment:


  • Can you program OrderEntry commands in a loop or only in explicit code

    Hi Ninja,

    I would like my strategy to place multiple order entries at certain increments within a certain price range.

    Now, I can go ahead and code these order entry lines one by one with all the specific order prices and signal names etc, but is there also a way to do it in a loop?

    I want to do something similar to the below code, but sofar the strategy analyzer keeps hanging in the loop and does not execute a single order:

    Code:
                 
    // Set 1
                if (Longs == true)
                {    
                     while (StopPrice >= StartRange && StopPrice <= EndRange)
                    {    
                        StopPrice = StartRange + OrderIncrement;
                        EnterLongStopMarket(Convert.ToInt32(DefaultQuantity), StopPrice, StopPrice.ToString());
                    }
                }
    Is this way of coding at all possible (order entry in loops)?
    Hope you can help,

    Cheers,
    Vladja

Latest Posts

Collapse

Topics Statistics Last Post
Started by soon123, Today, 10:15 PM
0 responses
2 views
0 likes
Last Post soon123
by soon123
 
Started by tuliomgui, Today, 10:07 PM
0 responses
2 views
0 likes
Last Post tuliomgui  
Started by bhydsnh, Today, 10:06 PM
0 responses
1 view
0 likes
Last Post bhydsnh
by bhydsnh
 
Started by ketoeliteusa, Today, 09:59 PM
0 responses
1 view
0 likes
Last Post ketoeliteusa  
Started by ketoeliteusa, Today, 09:58 PM
0 responses
3 views
0 likes
Last Post ketoeliteusa  
Working...
X