Help pdz.... Continuing to study the tutorial - came across something that is not clear to me, can't figure out
A simple function that tells me if price is above or below the EMA. But that's not even the question.
why when Fact_Dn and Fact_UP take true or false values in function start, these values are also taken by global variables? It's not like we use return(Fact_Up) for example... unclear... or can we not use it?
Fact_Dn and Fact_UP are defined globally (outside functions), so they are visible and available in all functions.
Fact_Dn and Fact_UP are defined globally (outside functions), so they are visible and available in all functions.
No, it's understandable, we can see them, so we can use them from any location, but why do they get values from the start function? - that's the question...
no, it's understandable, we can see them, so we can use them from any point, but why do they get the values from the start function? - that's the question...
There's nothing complicated about accessing these variables. They are just visible in any EA function. At the beginning, they take values true - they are initialized with value true. Then, depending on the price position relative to the MAA, they take the values corresponding to the logic of the EA.
I want to write an indicator to display the closing price ratio with a period of 51 and 34 ... but something got confused ... how to display what would be visible on the entire history ... look at pliz ...
#property indicator_separate_window#property indicator_buffers 1#property indicator_color1 Teal//---- input parametersexternint Nom1=51;
externint Nom2=34;
externint CountBars=300 0;
double MomBuffer[];
//+------------------------------------------------------------------+//| expert initialization function |//+------------------------------------------------------------------+int init()
{
//---- indicator lineIndicatorBuffers(1);
SetIndexBuffer(0, MomBuffer);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,Teal);
//----return(0);
}
//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+int start()
{
if (CountBars>Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars);
int i,counted_bars=IndicatorCounted();
double Sum,Sum1,Sum2, otn;
for (i=1;i>Nom2; i++)
{
if (i=Nom1) sum1=sum;
sum=sum+close[i];
if (i=Nom2) Sum2=sum;
i++;
}
MomBuffer=sum2/sum1;
//----return(0);
}
//+------------------------------------------------------------------+
Please advise, if it's not difficult: how to write EA results to file without deleting previous entries. I use function FileHandle=FileOpen(FileName,FILE_CSV|FILE_READ|FILE_WRITE,";"); but only last record is saved, at new tick old record is zeroed or deleted.
Help pdz.... Continuing to study the tutorial - came across something that is not clear to me, can't figure out
A simple function that tells me if price is above or below the EMA. But that's not even the question.
why when Fact_Dn and Fact_UP take true or false values in function start, these values are also taken by global variables? It's not like we use return(Fact_Up) for example... unclear... or can we not use it?
Fact_Dn and Fact_UP are defined globally (outside functions), so they are visible and available in all functions.
firstly:
i = Min_Level + (Step/10000);
your i does not change
secondly
ObjectCreate ("H_LINE",OBJ_HLINE,0,0,i);
each object must have a unique name
And how do I change it?
such as
BEFORE the loop, write
i = Min_Level
and increase it in the loop
i = i+ (Step/10000);
Greetings All!
Guys, can you tell me where a newcomer to this forum should start?)
Greetings All!
Guys, can you tell me where a newcomer to this forum should start?)
Fact_Dn and Fact_UP are defined globally (outside functions), so they are visible and available in all functions.
No, it's understandable, we can see them, so we can use them from any location, but why do they get values from the start function? - that's the question...
no, it's understandable, we can see them, so we can use them from any point, but why do they get the values from the start function? - that's the question...
I want to write an indicator to display the closing price ratio with a period of 51 and 34 ... but something got confused ... how to display what would be visible on the entire history ... look at pliz ...
Hello!
Please advise, if it's not difficult: how to write EA results to file without deleting previous entries. I use function FileHandle=FileOpen(FileName,FILE_CSV|FILE_READ|FILE_WRITE,";"); but only last record is saved, at new tick old record is zeroed or deleted.