Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I fix this compile error for SetStopLoss

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

    How do I fix this compile error for SetStopLoss

    I am developing a strategy this part of my code :

    // Enter a Buy trade order
    entryPrice = Close[0];
    buyStopLossPrice = entryPrice - 10 * TickSize;
    EnterLong("BuyTrade");
    SetStopLoss("BuyTrade", CalculationMode.Price, buyStopLossPrice);
    }
    else if (difference >= 4 && CrossBelow(EMA(Closes[0], 4), EMA(Closes[0], 10), 1))
    {
    // Play an audio alert
    PlaySound("Alert1.wav");

    // Enter a Sell trade order
    entryPrice = Close[0];
    sellStopLossPrice = entryPrice + 10 * TickSize;
    EnterShort("SellTrade");
    SetStopLoss("SellTrade", CalculationMode.Price, sellStopLossPrice);
    }

    Gives me the following erros when I try to compile it:
    Click image for larger version

Name:	image.png
Views:	140
Size:	33.1 KB
ID:	1266554

    Could you help me fix the problem. Thanks!

    #2
    Hello Zardelx5152,

    SetStopLoss does not take 3 arguments. If you want to specify a signal name you need to use the second overload set that includes a from entry signal parameter. These are the two ways it can be used:

    SetStopLoss(CalculationMode mode, double value)

    SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool isSimulatedStop)​


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X