[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 282

 
drknn:


Here is the code editor for you: http://depositfiles.com/files/2ippj8zao - download, unzip, run (installation is not required). Open in this editor the file I posted for you earlier and look at your code - where the vertical dashed lines go.

Buying and selling following any indicator can be executed differently. Your intent is not entirely clear.

P.S.

The editor is already customized to the MQL4 language and it works with bracket highlighting.

Thank you very much!!!!
 
#property  indicator_separate_window

#property  indicator_buffers 2
#property  indicator_color1  DarkGray
#property  indicator_width1  5
#property  indicator_color2  Red
#property  indicator_width2  2



extern int    Show_For_Last_N_Days   = 100;
extern string _                      = "";
extern int    MA1_Period             = 12;
extern int    MA2_Period             = 26;
extern int    MA3_Period             = 9;

double        MacdBuffer[];
double        SignalBuffer[];


int init() {
   IndicatorBuffers(2);
   IndicatorShortName("MACD("+MA1_Period+","+MA2_Period+","+MA3_Period+")");
   IndicatorDigits(Digits+1);

   SetIndexLabel(    0,"MACD");
   SetIndexBuffer(   0,MacdBuffer);
   SetIndexStyle(    0,DRAW_HISTOGRAM);
   SetIndexDrawBegin(0,MA2_Period);

   SetIndexLabel(    1,"Signal");
   SetIndexBuffer(   1,SignalBuffer);
   SetIndexStyle(    1,DRAW_LINE);
   SetIndexDrawBegin(1,MA2_Period);

   return(0);
}




int start() {
   int i                       = Bars - IndicatorCounted() - 1;

   while(i>=0) {

      if(Time[i]>=iTime(NULL,PERIOD_D1,Show_For_Last_N_Days)) {
         MacdBuffer[i+1]       = iMA(NULL,0,MA1_Period,0,MODE_EMA,PRICE_CLOSE,i+1) - iMA(NULL,0,MA2_Period,0,MODE_EMA,PRICE_CLOSE,i+1);

         for(int k=0; k<=MA3_Period; k++) {                                  //---- signal line counted in the 2-nd buffer
            SignalBuffer[k+1]  = iMAOnArray(MacdBuffer,0,MA3_Period,0,MODE_SMA,k+1);
         }
      }

      i--;
   } // while(i>=0) {

   return(0);
}



- Why doesn't iMAOnArray work in this example (and as a consequence the signal line is not displayed)?
Thank you!
 
chief2000:


- Why doesn't iMAOnArray work in this example (and consequently no signal line is displayed)?
Thank you!


because the loop is in a loop.

 
sergeev:

because it's a cycle within a cycle.



Removed "for" and replaced "to" with "i" (it was like that before experiments), but iMAOnArray still doesn't work:
SignalBuffer[i+1]  = iMAOnArray(MacdBuffer,0,MA3_Period,0,MODE_SMA,i+1);
- Why?
 
chief2000:

Removed "for" and replaced "to" with "i" (it was like that before the experiments), but iMAOnArray still doesn't work:


Try to contact developers - it must be a terminal bug, at least let them fix something in the next build of the terminal to make it work properly by your logic, is your code correct? :-)
 
Roman.:

Try to contact the developers - it's certainly a bug in the terminal, at least let them fix something in the next build of the terminal that everything works as it should according to your logic, you - is the code correct? :-)
You have nowhere to fluff?
 
chief2000:
You have nowhere to fluff?

Sorry, I didn't mean to upset you in any way, I just recently associated you with a frequenter of such branches with this kind of questions:

"Everyone uses the Comment() command, it's especially useful during code debugging.
The problem occurs because it has some limitation on the number of strings used.
If you add lines that exceed the limit, an error occurs at compile time:"

That's why, I found it necessary to advise you of the possible need to go directly to the developers, there, you never know, maybe something else is wrong?

 
Roman.:

Sorry, I didn't mean to upset you in any way, I just recently associated you with a frequenter of such branches with this kind of questions:

"Everyone uses the Comment() command, it is especially useful during code debugging.
The problem occurs because it has some limitation on the number of strings being used.
If you add lines that exceed the limit, an error occurs at compile time:"

That's why, I found it necessary to advise you of the possible need to go directly to the developers, well, there, just you know, maybe something else is wrong?

I don't really give a shit about your associations - this is a technical support forum and the question is perfectly legitimate.
 
chief2000:
I somehow don't give a shit. your associations - this is a technical support forum and the question is perfectly legitimate.


Thank you. That's hilarious.
 

hello everyone!!!

question: how can i call the monetary value of all trades up to the last take profit?

thanks if anyone can answer or write the code.