Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple strategy doesnt open trades

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

    Simple strategy doesnt open trades

    I have a simmple strategy that doesnt open trades.
    If i remove
    ExitLongStopMarket(0, true, 1, fvgIndicator.LowerPriceL[0], "SLL", "Long");
    ExitLongLimit(0, true, 1, Position.AveragePrice + (TickSize * 35), "PTL", "Long");
    and just use set methods strategy opens fine
    SetProfitTarget(CalculationMode.Ticks, 25);
    SetStopLoss(CalculationMode.Ticks, 25);
    I dont want to use set methods... No errors
    ​​

    Code:
        protected override void OnBarUpdate()
            {
                if(CurrentBar < 10)
                    return;
    //            if    (CurrentBars[0] < 10 || CurrentBars[1] < 10 )
    //                return;
    
                if(Low[0] < fvgIndicator.UpperPriceL[0]  && fvgIndicator.IsLongFVG[0] == -1 )                    
    
                {
    
                    EnterLong(1, "Long");
                    Print("Entering Long" + Time[0]);
    
                    if (Position.MarketPosition == MarketPosition.Long ) {
                        if(Position.AveragePrice - (fvgIndicator.LowerPriceL[0]) <= GetCurrentBid()){
                         ExitLongStopMarket(0, true, 1, fvgIndicator.LowerPriceL[0], "SLL", "Long");
                        ExitLongLimit(0, true, 1, Position.AveragePrice + (TickSize * 35), "PTL", "Long");
                        }
                    }
    
                }
    
                if(High[0] > fvgIndicator.LowerPriceS[0]  && fvgIndicator.IsShortFVG[0] == 1 )    
                {
    
                    EnterShort(1, "Short");
                    Print("Entering Short" + Time[0]);
    
                }
    
    
    
    
            }​

    #2
    Hello tkaboris,

    The given code should not work because you used the wrong signal name for those orders.

    Comment


      #3
      When I enter long i enter with "Long" and longstopmarket also uses "Long". why is it wrong signal name?

      Comment


        #4
        Hello tkaboris,

        The code you provided is a short order with the name "Short". The exit orders are looking for an entry named "Long". Make sure you are using the right signal names or provide an accurate sample of the code.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        45 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        21 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        31 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        50 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Working...
        X