I’m using this method to execute an order
private void ExecuteTrade(bool isLong)
{
double stopLoss;
double profitTarget;
if (isLong)
{
stopLoss = wickExtreme - (2 * TickSize);
double risk = Close[0] - stopLoss;
profitTarget = Close[0] + (risk * RiskRewardRatio);
EnterLong(Quantity, "ex_1");
SetStopLoss("ex1", CalculationMode.Price, stopLoss, false);
SetProfitTarget("ex1", CalculationMode.Price, profitTarget);
Draw.ArrowUp(this, "LongEntry_" + CurrentBar.ToString(), true, 0, Low[0] - (2 * TickSize), Brushes.Green);
}
else
{
stopLoss = wickExtreme + (2 * TickSize);
double risk = stopLoss - Close[0];
profitTarget = Close[0] - (risk * RiskRewardRatio);
EnterShort(Quantity, "ex_2");
SetStopLoss("ex2", CalculationMode.Price, stopLoss, false);
SetProfitTarget("ex2", CalculationMode.Price, profitTarget);
Draw.ArrowDown(this, "ShortEntry_" + CurrentBar.ToString(), true, 0, High[0] + (2 * TickSize), Brushes.Red);
}
totalTrades++;
Print("Trade executed: " + (isLong ? "LONG" : "SHORT") + " at " + Close[0] + " | Stop: " + stopLoss + " | Target: " + profitTarget);
}
The problem is that I’ve mess with something because I wanted to create like a 1:2 ratio, but something is wrong, but then I thought, ok if I already have an ATM with the correct StopLoss/Target and contracts, why can’t I use this instead? But I don’t know how to implement it here on my code, can anyone help me out?