[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 267

 
CLAIN:

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.
 
ilunga:

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 am I supposed to change it?
 
Gerkl:
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?)

 
Valdemar:

Greetings All!

Guys, can you tell me where a newcomer to this forum should start?)

Three hundred quid each... each... :)))
 
PapaYozh:

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...
 
CLAIN:

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 parameters
extern int Nom1=51;
extern int Nom2=34;
extern int CountBars=300 0;

double MomBuffer[];
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   IndicatorBuffers(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);
  }
//+------------------------------------------------------------------+
 

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.

 
I have the following question: How to switch timeframes simultaneously on several currency pairs (simultaneously). Thank you in advance.