Thanks!
#region Variables
private int stoplosstk = 40; // Default setting for Stoploss
private int target1 = 4; // Default setting for Target1
private double target2 = 8; // Default setting for Target2
private int target3 = 11; // Default setting for Target3
private double BuyMktT2Fill = 0; // Fill price of "BuyMktT2"
private double BuyMktT3Fill = 0; // Fill price of "BuyMktT3"
#endregion
protected override void Initialize()
{
SetProfitTarget("BuyMktT1", CalculationMode.Ticks, Target1);
SetProfitTarget("BuyMktT2", CalculationMode.Ticks, Target2);
SetProfitTarget("BuyMktT3", CalculationMode.Ticks, Target3);
SetProfitTarget("BuyLmt1", CalculationMode.Ticks, 5);
SetProfitTarget("BuyLmt2", CalculationMode.Ticks, 6);
SetStopLoss("", CalculationMode.Ticks, Stoplosstk, false);
Add(PeriodType.Tick, 150); // Add a 150 TICK Bars object to the strategy
CalculateOnBarClose = true;
}
// LONG Condition 1
{
SetStopLoss(CalculationMode.Ticks, stoplosstk); // Resets the STOPLOSS to the original value
EnterLong(1,6, "BuyMktT1"); // Sold at 4 ticks profit from entry
EnterLong(1,2, "BuyMktT2"); // Sold at 8 ticks profit from entry
EnterLong(1,2, "BuyMktT3"); // Sold at 10 ticks profit from entry
}
// LONG Condition 2 - Extra contracts on 3pt candle
{
SetStopLoss(CalculationMode.Ticks, stoplosstk); // Resets the STOPLOSS to the original value
EnterLongLimit(1,5, Close[0] - 3 * TickSize, "BuyLmt1"); // Sold at 5 ticks profit from entry
EnterLongLimit(1,5, Close[0] - 4 * TickSize, "BuyLmt2"); // Sold at 4 ticks profit from entry
DrawDiamond("BuyLmtDiamond" + CurrentBar, false, 0, Low[0] + -16 * TickSize, Color.Green);
}
// Checks if OnBarUpdate() is called from an update on 150 TICK Bars
if (BarsInProgress == 1)
{
// If a long position is open, allow for stop loss modification to breakeven
if (Position.MarketPosition == MarketPosition.Long)
{
// If 150 tick price is greater than BuyMktT2 entry price + 7 ticks, set stoploss to breakeven
if (High[0] >= BuyMktT2Fill + 8 * TickSize) <<<--- HERE IS WHERE I NEED HELP !!!!!
{
SetStopLoss(CalculationMode.Price, BuyMktT2Fill); // set stoploss to b/e
}
}
}

Comment