I am working on a little strategy and the trailing stop does not appear to be trailing.
Here are my variables
private string direction = "Long"; // Long = Only take Buy trades; opposite is true for Short private bool trade = false; // True = Take a trade private double support; // Support price level private double resistance; // Resistance price level
SetStopLoss("Buy Long", CalculationMode.Price, Support, false); SetStopLoss("Sell Short", CalculationMode.Price, Resistance, false); SetTrailStop("Buy Long", CalculationMode.Price, Support, false); SetTrailStop("Sell Short", CalculationMode.Price, Resistance, false); CalculateOnBarClose = true; // Will be change to false when code is finished
if ((Low[5] > Low[3] && Low[4] > Low[3] && Low[2] > Low[3] && Low[1] > Low[3]) || (Low[5] > Low[3] && Low[4] > Low[3] && Low[2] == Low[3] && Low[1] > Low[3])) { Support = Low[3]; Print(Time[0] + " Support = " + Support);
if (Trade == true && Low[0] < Support && Direction == "Short") { EnterShort(DefaultQuantity, "Sell Short"); Print(Time[0] + " " + "Short Entry. Stop = ");
At this point, though, the stop just remains in place (it never moves from the initial stop placement). I have checked the Output Window and it shows that it is storing new "resistance" levels - but just not moving the stop to those levels.
Could you please help me with what is going on in order to get the stop to trail correctly?
Thank you very much for your help!
Comment