Hello,
I am attempting to modify a TMA centered indicator and could use some help. As the indicator stands now it plots points where price breaches either of the bands. The logic I am attempting to implement is fairly simple: If two consecutive breaches (the teal dots in the picture) of the upper band occur while the most recent breach is equal to or lower than the price of the previous breach a 'Sell" signal is generated. If two consecutive breaches of the lower band occur while the most recent breach is equal to or higher than the price of the previous breach a 'Buy' signal is generated.
I have attached a picture to show that the yellow arrows are generated correctly, however the most recent arrow is not and I am not sure why it is occurring. It will quickly correct itself and disappear but I am not sure why it is being drawn in the first place. I am assuming it has to do with assigning the past breach time to the current breach time but again, I am not sure. I imagine there is a better way of doing this but I am currently unaware of how to do that. I am not particularly good at programming, I know just enough to make a mess of things. I am hoping someone is able to help me correct this problem or direct me to a better way of doing it.
The portion of the code that plots the points is here:
{
int shift1 = iBarShift(NULL,timeFrame,Time[i]);
datetime time1 = iTime (NULL,timeFrame,shift1);
tmBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,0,shift1);
upBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,1,shift1);
dnBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,2,shift1);
upArrow[i] = EMPTY_VALUE;
dnArrow[i] = EMPTY_VALUE;
upDot[i] = EMPTY_VALUE;
dnDot[i] = EMPTY_VALUE;
if (Close[i+1] > upBuffer[i+1] && Close[i+1] > Open[i+1] && Close[i] < Open[i]){
pastUpperBreachTime = currentUpperBreachTime;
currentUpperBreachTime = Time[i];
upperBreachShift = iBarShift(NULL,0,pastUpperBreachTime);
lowerBreachShift = iBarShift(NULL,0,currentLowerBreachTime);
previousUpperBreachClose = Close[upperBreachShift];
currentUpperBreachClose = Close[i];
upDot[i] = High[i]+iATR(NULL,0,20,i);
if((upperBreachShift < lowerBreachShift) && (currentUpperBreachClose < previousUpperBreachClose)){
upArrow[i] = High[i]+(iATR(NULL,0,20,i) * 2.75);
}
}
if (Close[i+1] < dnBuffer[i+1] && Close[i+1] < Open[i+1] && Close[i] > Open[i]){
pastLowerBreachTime = currentLowerBreachTime;
currentLowerBreachTime = Time[i];
lowerBreachShift = iBarShift(NULL,0,pastLowerBreachTime);
upperBreachShift = iBarShift(NULL,0,currentUpperBreachTime);
previousLowerBreachClose = Close[lowerBreachShift];
currentLowerBreachClose = Close[i];
dnDot[i] = Low[i]-iATR(NULL,0,20,i);
if((lowerBreachShift < upperBreachShift) && (currentLowerBreachClose > previousLowerBreachClose)){
dnArrow[i] = Low[i]-(iATR(NULL,0,20,i) * 2.75);
}
}
Thanks for any help or suggestions!
Centered TMA is recalculating/repainting.
As I have tried to explain in numerous occasions - using recalculating indicators in any form of "signaling" mode is dangerous and it does not lead to results that people expect. I would like recommend to all using centered TMA to read this book : https://www.amazon.com/Channels-Cycles-Tribute-J-Hurst/dp/0934380503 in order to get a clear picture how centered TMA (and bands) should be used
please
kindly help modify this Givonly_SnR_SnD_r2.mq4 ( 8 Kb) of one's of The indicator's values not Considered AT every tick, But on every new candle. so that it stop freezing my terminal
please i will of the BE very greatfull if someone can CAN help or direct Were i to me please the CAN the get IT.
princecoolhotspot@yahoo.com
thanks
Centered TMA is recalculating/repainting.
As I have tried to explain in numerous occasions - using recalculating indicators in any form of "signaling" mode is dangerous and it does not lead to results that people expect. I would like recommend to all using centered TMA to read this book : https://www.amazon.com/Channels-Cycles-Tribute-J-Hurst/dp/0934380503 in order to get a clear picture how centered TMA (and bands) should be used
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I am attempting to modify a TMA centered indicator and could use some help. As the indicator stands now it plots points where price breaches either of the bands. The logic I am attempting to implement is fairly simple: If two consecutive breaches (the teal dots in the picture) of the upper band occur while the most recent breach is equal to or lower than the price of the previous breach a 'Sell" signal is generated. If two consecutive breaches of the lower band occur while the most recent breach is equal to or higher than the price of the previous breach a 'Buy' signal is generated.
I have attached a picture to show that the yellow arrows are generated correctly, however the most recent arrow is not and I am not sure why it is occurring. It will quickly correct itself and disappear but I am not sure why it is being drawn in the first place. I am assuming it has to do with assigning the past breach time to the current breach time but again, I am not sure. I imagine there is a better way of doing this but I am currently unaware of how to do that. I am not particularly good at programming, I know just enough to make a mess of things. I am hoping someone is able to help me correct this problem or direct me to a better way of doing it.
The portion of the code that plots the points is here:
{
int shift1 = iBarShift(NULL,timeFrame,Time[i]);
datetime time1 = iTime (NULL,timeFrame,shift1);
tmBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,0,shift1);
upBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,1,shift1);
dnBuffer[i] = iCustom(NULL,timeFrame,IndicatorFileName,"calculateTma",HalfLength,Price,BandsDeviations,2,shift1);
upArrow[i] = EMPTY_VALUE;
dnArrow[i] = EMPTY_VALUE;
upDot[i] = EMPTY_VALUE;
dnDot[i] = EMPTY_VALUE;
if (Close[i+1] > upBuffer[i+1] && Close[i+1] > Open[i+1] && Close[i] < Open[i]){
pastUpperBreachTime = currentUpperBreachTime;
currentUpperBreachTime = Time[i];
upperBreachShift = iBarShift(NULL,0,pastUpperBreachTime);
lowerBreachShift = iBarShift(NULL,0,currentLowerBreachTime);
previousUpperBreachClose = Close[upperBreachShift];
currentUpperBreachClose = Close[i];
upDot[i] = High[i]+iATR(NULL,0,20,i);
if((upperBreachShift < lowerBreachShift) && (currentUpperBreachClose < previousUpperBreachClose)){
upArrow[i] = High[i]+(iATR(NULL,0,20,i) * 2.75);
}
}
if (Close[i+1] < dnBuffer[i+1] && Close[i+1] < Open[i+1] && Close[i] > Open[i]){
pastLowerBreachTime = currentLowerBreachTime;
currentLowerBreachTime = Time[i];
lowerBreachShift = iBarShift(NULL,0,pastLowerBreachTime);
upperBreachShift = iBarShift(NULL,0,currentUpperBreachTime);
previousLowerBreachClose = Close[lowerBreachShift];
currentLowerBreachClose = Close[i];
dnDot[i] = Low[i]-iATR(NULL,0,20,i);
if((lowerBreachShift < upperBreachShift) && (currentLowerBreachClose > previousLowerBreachClose)){
dnArrow[i] = Low[i]-(iATR(NULL,0,20,i) * 2.75);
}
}
Thanks for any help or suggestions!