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:	134
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 NullPointStrategies, Today, 05:17 AM
    0 responses
    44 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    65 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X