I am simply trying to establish a STOP LOSS (intrabar) based on a calculation:
Stop Loss = Entry Price - (ATR(previous bar) * Multiple)
So, here are some issues:
1. SetStopLoss is inserted in script before [CalculateOnBarClose = TRUE]. This is good, assuming that SetStopLoss OVERRULES everything else and will exit a trade on tick that price touches calculated StopLoss.
2. Entry Conditions are inserted after [CalculateOnBarClose = TRUE]. Again, correct per my strategy. Bar data only is sufficient.
So, where(how?) do I create this variable called, Stop Loss?
I must be coding something wrong because the strategy produces correct entries but every trade ends with being stopped out at same price as ENTRY.
#region Variables
privatedouble stopLong1 = 0; // Default setting for StopLong
protectedoverridevoid Initialize()
{
stopLong1 = ((double)ATR(atrlength)[0] * (double)atrmult * 10000);
SetStopLoss("Entry Label",CalculationMode.Ticks,stopLong1, false);
}
#region Properties

Comment