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

Second Breakeven

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

    Second Breakeven

    hello
    I would have added a second breakeven the first 5 + 1 and the second
    7 + 4 only when the market goes over +7 ticks in my favor and then
    goes back to +6, the breakeven "dances" between +1 and + 4 This is the
    code, am I probably missing something?
    thank you very much


    Massimiliano





    protected override void OnBarUpdate()
    {
    if (CurrentBar < BarsRequiredToTrade)
    return;
    // Resets the stop loss to the original value when all positions are closed
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    TriggerState = 0;
    SetStopLoss(CalculationMode.Ticks, StopLossTicks);
    }
    // If a long position is open, allow for stop loss modification to breakeven
    else if (Position.MarketPosition == MarketPosition.Long)
    {
    // Once the price is greater than entry price+3 ticks, set stop loss
    to breakeven
    if (Close[0] > Position.AveragePrice + 3 * TickSize)

    {
    TriggerState=1;
    SetStopLoss(CalculationMode.Price, Position.AveragePrice +1*TickSize);
    }
    //
    // Once the price is greater than entry price+3 ticks, set stop loss
    to breakeven
    if (Close[0] > Position.AveragePrice + 7 * TickSize)
    {
    TriggerState= 2;
    SetStopLoss(CalculationMode.Price, Close[1] +4*TickSize);
    }

    #2
    Hello Massimiliano,

    This appears to be the same text in an email I have received.

    Are you creating multiple inquiries for the same question?

    While we are happy to assist on the forums or with you privately through email with our platformsupport [at] ninjatrader [dot] com address, we respectfully ask that you only create one inquiry. This can be privately in email or can be a public thread on the forum.

    If you would no longer like to communicate through email and you would like to communicate on the forums, please let us know so and we will converse solely through the forums.

    Creating both a forum thread and an email with platformsupport [at] ninjatrader [dot] com will create two separate tickets and may cause multiple technicians to start at the beginning of reviewing your inquiry, tying up resources with our platform support and delaying our ability to respond to all customers in a timely manner.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Halmix, Today, 07:12 AM
    0 responses
    6 views
    0 likes
    Last Post Halmix
    by Halmix
     
    Started by Bobin, Today, 06:39 AM
    0 responses
    8 views
    0 likes
    Last Post Bobin
    by Bobin
     
    Started by KirkHammett, Today, 03:23 AM
    0 responses
    5 views
    0 likes
    Last Post KirkHammett  
    Started by eleven, Yesterday, 10:06 PM
    0 responses
    39 views
    0 likes
    Last Post eleven
    by eleven
     
    Started by ezrollin, Yesterday, 08:12 PM
    7 responses
    73 views
    0 likes
    Last Post bltdavid  
    Working...
    X