It seems like SetStopLoss is not working in my strategy.
1)When using EnterLong() -by default it used the close of the Candle -- Is it possible to use Open of the Candle ?
if (Basp.ChannelingUP[0])
{
double entryPrice = Bars.GetOpen(CurrentBars[0]); // Get the open price of the current candle
double stopLossPrice = entryPrice + 8; // Calculate the stop loss price (adjust as needed)
string signalName = "ENTERLONG";
Print("Entering long at open price: " + entryPrice); // Print the entry price
EnterLongLimit(entryPrice, signalName);
Print("Adding stop loss at price: " + stopLossPrice); // Print the stop loss price
SetStopLoss("StopLos****OnLP", CalculationMode.Price, stopLossPrice, false);
}
else if (Basp.ChannelingDOWN[0])
{
double stopLossPrice = Close[0] + 8; // Calculate the stop loss price (adjust as needed)
string signalName = "ENTERSHORT";
double entryPrice = Bars.GetOpen(CurrentBars[0]); // Get the open price of the current candle
Print("Entering short at open price: " + entryPrice); // Print the entry price
EnterShortLimit(entryPrice, signalName);
Print("Adding stop loss at price: " + stopLossPrice); // Print the stop loss price
SetStopLoss("StopLos****OnSP", CalculationMode.Price, stopLossPrice, false);
}
Trading NQ23 future -1 Quantity.
Someoutput from the code
Time: 12/1/2023 11:54:00 AM | ChannelingDOWN[0]: True Entering short at open price: 16017.25 Adding stop loss at price: 16021.75 Time: 12/1/2023 11:55:00 AM | ChannelingUP[0]: True Entering long at open price: 16013.5 Adding stop loss at price: 16021.5 Time: 12/1/2023 12:07:00 PM | ChannelingDOWN[0]: True Entering short at open price: 16026 Adding stop loss at price: 16020.5 Time: 12/1/2023 12:12:00 PM | ChannelingUP[0]: True Entering long at open price: 16022.25 Adding stop loss at price: 16030.25 Time: 12/1/2023 12:16:00 PM | ChannelingDOWN[0]: True Entering short at open price: 16019.25 Adding stop loss at price: 16026.5 Time: 12/1/2023 12:27:00 PM | ChannelingUP[0]: True Entering long at open price: 16020.5 Adding stop loss at price: 16028.5 Time: 12/1/2023 12:39:00 PM | ChannelingDOWN[0]: True Entering short at open price: 16024.25 Adding stop loss at price: 16026.25 Time: 12/1/2023 12:56:00 PM | ChannelingUP[0]: True Entering long at open price: 16006 Adding stop loss at price: 16014 Time: 12/1/2023 1:02:00 PM | ChannelingDOWN[0]: True Entering short at open price: 16019.25 Adding stop loss at price: 16020 Time: 12/1/2023 1:05:00 PM | ChannelingUP[0]: True Entering long at open price: 16025 Adding stop loss at price: 16033 Time: 12/1/2023 1:49:00 PM | ChannelingDOWN[0]: True Entering short at open price: 16033 Adding stop loss at price: 16040.75

Comment