Индикаторы: Уровень SL по ATR

 

Уровень SL по ATR:

Индикатор показывает минимальный и максимальный уровень Stop Loss для позиций Buy и Sell на любой момент.

Author: Vladimir Khlystov

 
Может я после праздника туплю. но что-то меня в коде смущает вот-это
iATR(Symbol(),0,Period_ATR,0)
 
leman:
Может я после праздника туплю. но что-то меня в коде смущает вот-это
iATR(Symbol(),0,Period_ATR,0)

Правильно, что смущает. В конце строки вместо 0 должно стоять i.
 

А я бы сделал вот так:

      ATR = iATR(NULL,0,Period_ATR,i+1);
      SLBayMin[i]  = NormalizeDouble(Low[i+1]  + ATR,Digits);
      SLSellMin[i] = NormalizeDouble(High[i+1] - ATR,Digits);
      SLBayMax[i]  = NormalizeDouble(High[i+1] + ATR,Digits);
      SLSellMax[i] = NormalizeDouble(Low[i+1]  - ATR,Digits);
 
leman:

А я бы сделал вот так:

      ATR = iATR(NULL,0,Period_ATR,i+1);
      SLBayMin[i]  = NormalizeDouble(Low[i+1]  + ATR,Digits);
      SLSellMin[i] = NormalizeDouble(High[i+1] - ATR,Digits);
      SLBayMax[i]  = NormalizeDouble(High[i+1] + ATR,Digits);
      SLSellMax[i] = NormalizeDouble(Low[i+1]  - ATR,Digits);


поясните смысл сего.

И еще очень интересно, почему исчезают мои сообщения??? Вопрос к модераторам.

 
cmillion:
leman:

А я бы сделал вот так:

      ATR = iATR(NULL,0,Period_ATR,i+1);
      SLBayMin[i]  = NormalizeDouble(Low[i+1]  + ATR,Digits);
      SLSellMin[i] = NormalizeDouble(High[i+1] - ATR,Digits);
      SLBayMax[i]  = NormalizeDouble(High[i+1] + ATR,Digits);
      SLSellMax[i] = NormalizeDouble(Low[i+1]  - ATR,Digits);


поясните смысл сего.

И еще очень интересно, почему исчезают мои сообщения??? Вопрос к модераторам.


Здрасьте! А мне кажется, что у вас верх с низом перепутан. Ведь Стопы у Бая надо ставить снизу, значит надо вычитать АТR. У Селла, естественно, всё наоборот.

Если, конечно, АТR не имеет отрицательного значенмя. У меня АТR всегда положительный. А у вас?

      ATR = iATR(Symbol(),0,Period_ATR,i);
      SLSellMin[i] = NormalizeDouble(Low[i]  + ATR,Digits);
      SLBayMin[i]  = NormalizeDouble(High[i] - ATR,Digits);
      SLSellMax[i] = NormalizeDouble(High[i] + ATR,Digits);
      SLBayMax[i]  = NormalizeDouble(Low[i]  - ATR,Digits);

Поменял Селл с Баем и всё стало нормально. Или я что-нибудь не понимаю? А [i] лучше, чем [i+1], потому что и так запаздывание неизбежно.

Если хотите Стоп увеличить, можно АТR умножить на 1.4 или как угодно будет.

 

thank you for this,

but can you adjust it so we can have an option to only show how many bars back the sl atr level should appear on the chart? for example i would like to have the sl atr level only appear on current bar so it will not clutter the chart.

can you make that adjustment?

thanks again.

 
Yes of course.
I can only do the levels for use in EA. This buzhet much more fun than an indicator. write on mail cmillion@narod.ru
 
cmillion:

Yes of course.
I can only do the levels for use in EA. This buzhet much more fun than an indicator. write on mail cmillion@narod.ru
but im not going to use it as part of an EA. im doing the manual trade. it is just that i want to see only levels for current bar and one bar back. so it will not clutter up the whole chart. does it mean that you are going to charge it for some dollars if i make a request through your email?
 
bolasatuboladua:

thank you for this,

but can you adjust it so we can have an option to only show how many bars back the sl atr level should appear on the chart? for example i would like to have the sl atr level only appear on current bar so it will not clutter the chart.

can you make that adjustment?

thanks again.


Hello! I do not know English. Only the Google translation.
I limited the number of bars in the indicator lines. But I have not found a way to eliminate the growing queue. TF must be changed and again the number of bars is chosen.

extern int limit = 60;//or any number
//+------------------------------------------------------------------+
// int limit = Bars-counted_bars;
//+------------------------------------------------------------------+

for (int i = 0; i < limit; i++)

Good luck!
 
bolasatuboladua


For the current trade, I can only do tags on the current bar, but for efficiency and will sit on the e-mail address.
Here, this option no one will be useful.
Причина обращения: