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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        163 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        82 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        125 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        206 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        185 views
        0 likes
        Last Post CarlTrading  
        Working...
        X