Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help me with a order

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

  • NinjaTrader_Bertrand
    replied
    Firecan, you would need to add print statements to debug your code, making sure the logic triggers to adjust the stop to a new price level - http://www.ninjatrader.com/support/f...ead.php?t=3418

    You can adjust intrabar when trading it live or in MarketReplay if you set the CalculateOnBarClose setting to false - http://www.ninjatrader-support.com/H...BarClose1.html

    Leave a comment:


  • firecan
    replied
    help with a order

    Ok. thanks I try it. (>=)

    And now:

    I have this order:

    // Once the price is greater than entry price+10 ticks, set stop loss to breakeven

    if (Close[0] >= Position.AvgPrice +10 * TickSize)
    { SetStopLoss(CalculationMode.Price, Position.AvgPrice); }

    first I´d like to know why do not work.

    But that I need is how send the stop loss to breakeven when the price arrive to entry +15 ticks, without wait closes a bar.

    Please if is possible do not send to the tutorial again, I do not understand.

    Thank you.

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    firecan,

    That would be expected because your code is looking for an exact match. You are using == which means the timestamp of the bar needs to match exactly the time you push in which is 14:29:00. On a 15 minute chart there would never be any bar timestamped as 14:29 and that is why nothing happens.

    Instead you should use numbers that would actually fit with the time frame of your chart or change your logic to use >= or <= and setup a range of acceptable values.

    Leave a comment:


  • firecan
    replied
    Hello again

    I have this order

    #region Variables
    private int horas = 00;
    private int minutos = 00;
    private int segundos = 00;
    #endregion

    // Condition Entry.
    if (ToTime(Time[0]) == ToTime(horas,minutos,segundos))
    { EnterShort }

    And send the order sometimes yes and sometimes not.

    If you put an hour as 15,00,00 - or 17,30,00 in general it works well.
    But if you place 14, 29, 00, or 13, 05, 00, it does not do anything.

    Can you tell me why.

    Thanks.

    (timeframe 15 mint.)
    Last edited by firecan; 09-01-2010, 03:29 PM.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    What kind of chart / timeframe are you running this on? Does it have a bar timestamp at this time, allowing your time condition to evaluate to true and trigger the trade?

    You can for example setup a user defined integer input for entering the time -

    Leave a comment:


  • firecan
    replied
    help with a order

    Hello again.
    I have this order that is executed at the exact hour.

    if (ToTime(Time[0]) == ToTime(15,45,00))
    { EnterLongStop(DefaultQuantity,Close[0]+0.000005, ""); }

    But when I change the hour of entry it stops working, I do not why.

    How to do that the order of the hour of entry into the zone of variables and her it could change this one there.


    #region Variables
    privateint stoplossticks = 20;
    privateint profittargetticks = 100;

    Here time of entry

    #endregion

    Thank you.

    Leave a comment:


  • NinjaTrader_Austin
    replied
    firecan, is there an error shown in the output window from TraceOrders?

    To send in a stop at breakeven without waiting for the bar to close would require you to run only certain logic every tick, and then your main strategy code on every closed bar. There is a reference sample that goes over how to do that. You can also take a look at the reference sample that goes over how to modify your stop loss/profit target prices.

    Leave a comment:


  • firecan
    replied
    Help me with a order

    Hello again.

    I have this order:

    // Once the price is greater than entry price+10 ticks, set stop loss to breakeven

    if (Close[0] >= Position.AvgPrice +10 * TickSize)
    { SetStopLoss(CalculationMode.Price, Position.AvgPrice); }

    first I´d like to know why do not work.

    And then I´d like to kown how send the stop loss to breakeven when the price arrive to entry +15 ticks, without wait closes a bar.

    Thank you.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    Thanks for the translation Sevilla, if you're enabling TraceOrders in your strategy you would see ignored orders in your output window while debugging it, this is because you're running into the internal order handling rules with the approach (on NT7 you could use the unmanaged order submission mode not 'guarded' by these rules) -



    Interal Order Handling Rules that Reduce Unwanted Positions
    NinjaTrader is a real-time live trading platform and thus we need to ensure that we prevent situations in real-time where you may have multiple orders working accomplishing the same task. An example of this would be if your strategy had a target limit order for 1 contract working and then your strategy issued a market order to close the position. This is dangerous since it could result in both orders getting filled and instead of having a flat position you are now short! To prevent these types of situations, there are some "under the hood" rules that a NinjaScript strategy follows when order methods are called.
    For the most part, you do not need to be intimately familiar with these rules as you develop your strategies, its all taken care of for you internal within a strategy. If a rule is violated, you will be notified through an error log in the Control Center log tab when running a strategy in real-time or in a backtest.
    The following rules are true per unique signal name excluding market orders:




    Methods that generate orders (excluding market orders) to enter a position will be ignored if:
    • A position is open and an order submitted by an exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
    • A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
    • The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction


    Methods that generate orders to exit a position will be ignored if a strategy position is open and:
    • An order submitted by an enter method (EnterLongLimit() for example) is active and this entry order is used to open a position in the opposite direction
    • An order submitted by a set method (SetStopLoss() for example) is active


    Set() methods that generate orders to exit a position will be ignored if a strategy position is open and:
    • An order submitted by an enter method (EnterLongLimit() for example) is active and this entry order is used to open a position in the opposite direction
    • An order submitted by an exit method (ExitLongLimit() for example) is active

    Leave a comment:


  • firecan
    replied
    Help with a order

    Hello my friend.

    The Rottweiller thing is just a hobby, I'm a fireman.

    I solved the problem with the breakeven.

    I'd like to know what am I doing wrong with this order:

    if (ToTime(Time[0]) == ToTime(14, 30, 00))
    { EnterLongStop(DefaultQuantity, Close[0] + 0.0005, ""); }
    { EnterShortStop(DefaultQuantity, Close[0] - 0.0005, ""); }

    The first long order is sent at the right time and it works when the price reaches it. But the second one is sent only when the first order is closed.

    What I really want is to send both orders at the same time, and I want them to work when the price reaches them, the two of them if it's necessary.

    I'm not looking to call an OCO order

    Waiting for your reply, regards.

    Leave a comment:


  • NinjaTrader_VinceB
    replied
    Originally posted by firecan View Post
    Hola , de nuevo mi amigo. Lo rottweiler es sólo un hobby , yo soy un bombero.

    He resuelto el problema con el punto de equilibrio. Me gustaría saber qué estoy haciendo mal con esta orden :


    / / Condición 1 juego
    si ( ToTime ( Tiempo [ 0] ) == ToTime (14 , 30, 00) )
    { EnterLongStop ( DefaultQuantity , Primer plano [0 ] + 0,0005, " ") ; }
    { EnterShortStop ( DefaultQuantity , Cerrar [ 0] - 0,0005, " ") ; }


    Se envía la orden de largo por primera vez en el momento adecuado y funciona cuando el precio alcanza . Pero el orden de corto segunda sólo se envía cuando el primero está cerrado.

    Lo que realmente quiero es enviar dos pedidos al mismo tiempo, y quiero que al trabajo cuando el precio llega a ellos , los dos de ellos si es necesario.

    No estoy buscando para llamar a una orden OCO.

    Esperando su respuesta, saludos.


    Firecan,

    Please write up your posts in English as this forum is English only. We don't address any issues in Spanish or other languages than English.

    Leave a comment:


  • firecan
    replied
    Help me with a order

    Hola , de nuevo mi amigo. Lo rottweiler es sólo un hobby , yo soy un bombero.

    He resuelto el problema con el punto de equilibrio. Me gustaría saber qué estoy haciendo mal con esta orden :


    / / Condición 1 juego
    si ( ToTime ( Tiempo [ 0] ) == ToTime (14 , 30, 00) )
    { EnterLongStop ( DefaultQuantity , Primer plano [0 ] + 0,0005, " ") ; }
    { EnterShortStop ( DefaultQuantity , Cerrar [ 0] - 0,0005, " ") ; }


    Se envía la orden de largo por primera vez en el momento adecuado y funciona cuando el precio alcanza . Pero el orden de corto segunda sólo se envía cuando el primero está cerrado.

    Lo que realmente quiero es enviar dos pedidos al mismo tiempo, y quiero que al trabajo cuando el precio llega a ellos , los dos de ellos si es necesario.

    No estoy buscando para llamar a una orden OCO.

    Esperando su respuesta, saludos.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    Nice Salvador, I bet that's a challenging profession, too...if you run into order placement issue and wish to debug those in your strategy, the TraceOrders feature we have is very helpful - http://www.ninjatrader.com/support/f...ead.php?t=3627

    For realtime use, you could call ATM templates to manage exits where a autoBreakeven is setup or use this sample code structure to move the stop as you're into profit -

    Leave a comment:


  • firecan
    replied
    Help me with a order

    Hello, thank you for your help. I tried to set the liveUntilCancelled parameter but it was not sucsesful. I solve the problem by the moment using 15 minutes bars.
    I noticed by reading your post that you live in Hamburg. I should have been in Germany yesterday because it was the rottweiller klubsieger show due to the fact that I´m a rottweiller breader.
    By the way, is it possible to send an autobreakeven order at the strategy, I can´t find it out.
    Waiting for your reply. Regards.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    firecan, please resubmit the order on the next bar or use the overload that offers you to set the 'liveUntilCancelled' parameter, per default orders expire at the end of bar in NinjaTrader.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Waxavi, Today, 02:10 AM
0 responses
2 views
0 likes
Last Post Waxavi
by Waxavi
 
Started by TradeForge, Today, 02:09 AM
0 responses
4 views
0 likes
Last Post TradeForge  
Started by Waxavi, Today, 02:00 AM
0 responses
2 views
0 likes
Last Post Waxavi
by Waxavi
 
Started by elirion, Today, 01:36 AM
0 responses
4 views
0 likes
Last Post elirion
by elirion
 
Started by gentlebenthebear, Today, 01:30 AM
0 responses
4 views
0 likes
Last Post gentlebenthebear  
Working...
X