I want to learn how to draw levels on the chart depending on the indicator values in a separate window. For example, if the MACD crosses level 0 from bottom to top, a line is drawn on the chart according to the Low of the bar where the crossing occurs. When the MACD is crossed from the top downwards, the line on High will be drawn accordingly. I have written something, it compiles without errors, but nothing happens. Can you help me please?
#property indicator_chart_window#property indicator_buffers 1#property indicator_color1 Bluedouble Buffer[];
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int init()
{
//---- drawing settingsSetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Buffer);
return(0);
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+int start()
{
int limit;
double level;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recountedif(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
double macd = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i);
double macd1 = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i+1);
if (macd > 0 && macd1 < 0)
{
level = iLow("EURUSD",PERIOD_M1,i); //Почему выскакивает ощибка если написать просто iLow[i]?
Buffer[i]=level;
}
elseif (macd < 0 && macd1 > 0)
{
level = iHigh("EURUSD",PERIOD_M1,i); //Почему выскакивает ощибка если написать просто iHigh[i]?
Buffer[i]=level;
}
return(0);
}
I want to learn how to draw levels on the chart depending on the indicator values in a separate window. For example, if the MACD crosses level 0 from bottom to top, a line is drawn on the chart according to the Low of the bar where the crossing occurs. When the MACD is crossed from the top downwards, the line on High will be drawn accordingly. I have written something, it compiles without errors, but nothing happens. Please help.
line is at least 2 points ;)
Buffer[i]=level;
it's one point, the adjacent ones are probably zero. that's why the line has nowhere to be drawn
//Почему выскакивает ощибка если написать просто iLow[i]?
Is there any way to divide the distance between the two prices into 3-4 parts, not just divide them, but also know the price of each of the resulting parts?
sss2019: Is there any way to divide the distance between the two prices into 3-4 parts, not just divide them, but also know the price of each of the resulting parts?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Tell me, if I'm not an expert in programming.
Does this thing look at the history when opening an order or not?
Tell me, if I'm not good at programming.
does this thing look in the history when opening an order or not ?
1) use the SRC tag when inserting code
2) delete what is commented out.
3) tell us what you want to see and what the discrepancy is
1) use the SRC tag when inserting code
2) remove what is commented out
3) tell me what you want to see and what is the discrepancy
src inserted
What is commented out?
there is a discrepancy in the number of profitable deals in the tester, that's why I asked
I want to learn how to draw levels on the chart depending on the indicator values in a separate window. For example, if the MACD crosses level 0 from bottom to top, a line is drawn on the chart according to the Low of the bar where the crossing occurs. When the MACD is crossed from the top downwards, the line on High will be drawn accordingly. I have written something, it compiles without errors, but nothing happens. Can you help me please?
src inserted
I do not know what has been commented
there is a discrepancy in the number of profitable trades in the tester
there are always 2 objects in the match that are compared.
does the tester not match the demo on the same period? For example, because the spread in the tester is different
I want to learn how to draw levels on the chart depending on the indicator values in a separate window. For example, if the MACD crosses level 0 from bottom to top, a line is drawn on the chart according to the Low of the bar where the crossing occurs. When the MACD is crossed from the top downwards, the line on High will be drawn accordingly. I have written something, it compiles without errors, but nothing happens. Please help.
line is at least 2 points ;)
it's one point, the adjacent ones are probably zero. that's why the line has nowhere to be drawn
//Почему выскакивает ощибка если написать просто iLow[i]?because Low[i] has no "i" at the beginningWhere is that basket?
Is there any way to divide the distance between the two prices into 3-4 parts, not just divide them, but also know the price of each of the resulting parts?
a line is at least 2 points ;)
this is one point, the neighbouring ones are probably zero. therefore there is nowhere to draw the line
because Low[i] has no "i" at the beginningSo, I either need to create a previous point or draw an Arrow instead of a line. Thanks, I'll keep racking my brains.