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

 
mersi:

The new knowledge gained, despite the personal time spent, is the most valuable prize.

The best investment is an investment in knowledge/skills.

100% agree. When are you going to write? When you do, I'll give you some more ideas for prizes. Or just look into the branch to Yusufkhoja - there are a ton of prizes. Invest in their knowledge and skills.
 

Good afternoon everyone, I have this little question: how correct is it to pass the inverse value of a logical variable to a user function? For example:

bool X;

.........

MyFunction(!X);

 
Elenn:

Good afternoon everyone, I have this little question: how correct is it to pass the inverse value of a logical variable to a user function? For example:

bool X;

.........

MyFunction(!X);

This is normal.
 
Zhunko:
This is normal.

Thank you!
 

Afternoon All, there is a MA_In_Color_wAppliedPrice indicator, how do I get the signal out of there when the colour changes?-------------------------------------------------+

//-------Красить начинается по моему здесь..
      ExtMapBuffer3[i]=MA_Cur; //red 
      ExtMapBuffer2[i]=MA_Cur; //green
      ExtMapBuffer1[i]=MA_Cur; //yellow
      if (MA_Prev > MA_Cur)
        {
         ExtMapBuffer2[i]=EMPTY_VALUE;
        }
      else if (MA_Prev < MA_Cur)
           {
            ExtMapBuffer1[i]=EMPTY_VALUE; //-1 red/greem tight
           }
         else
           {
            ExtMapBuffer1[i]=EMPTY_VALUE;//EMPTY_VALUE;
            ExtMapBuffer2[i]=EMPTY_VALUE;//EMPTY_VALUE;
           }
     }
//----  

 
libeadier:

Afternoon All, there is a MA_In_Color_wAppliedPrice indicator, how do I get the signal out of there when the colour changes?-------------------------------------------------+

Each colour of indicator has its own buffer. Poll the data of each buffer in your EA. If a non-empty value (! EMPTY_VALUE) appears in one of the buffers, it indicates the appearance of a line of the corresponding colour (or no line - I don't see what it draws there)
 
artmedia70:
Each indicator colour corresponds to its own buffer. Poll the data of each buffer in the EA. If a non-empty value (! EMPTY_VALUE) appears in one of the buffers, it tells about the appearance of a line of the corresponding colour (or not - I don't see what it draws there)
Awesome, thanks.
 
VladislavVG:
100% agree. When will you start writing? As you write, I'll give you more prize ideas. Or just look at a branch of Yusufhoja - there are a ton of prizes. Invest in their knowledge and skills.

1. neural network training is of interest. I'm waiting for an idea.

2. In leafing through the topics, I noticed that Yusufhoja is one of the most "prolific" topic generators here. Which of his topics should I look into?

 

Please suggest the code below to read the log file. Automatically reads the current log file by date and outputs it to the printer.

Where:

while (result>0) {

The file is being assembled from parts. But I don't need the whole file, just the last line. Help to correct, please.

void ReadWrite() {
   string tekTime=TimeStr1(CurTime(),1);
   string path=TerminalPath()+"\\logs\\"+tekTime+".log";
   string title="Чтение из файла";
   string msg;
   int result;
   int handle=_lopen(path,4);
   if (handle<0) {
      msg="Ошибка открытия файла";
      //MessageBox(msg,title,MB_OK|MB_ICONERROR);
      Print(msg);
      return;
   }
   result=_llseek (handle,0,0);
   string buffer="";
   //string char="x                      ";
   string char="x                                                                                                                                                                                                                                                         ";
   int count=0;
   result=_lread (handle,char,250);
   while (result>0) {
      buffer=buffer+char;
      char="x                                                                                                                                                                                                                                                         ";
      count++;
      result=_lread (handle,char,250);
   }
   result=_lclose (handle);
   msg=StringTrimRight(buffer);
   //MessageBox(msg,title,MB_OK|MB_ICONINFORMATION);
   Print(msg);
}

//------------------расчет времени----------------
string TimeStr1(int taim,int tip)
{
   string sTaim;
   string sTaim1,sTaim2,sTaim3;
   if (tip==1) 
   {
      int GD=TimeYear(taim);                  
      int MN=TimeMonth(taim);                  
      int DD=TimeDay(taim);  
      
      sTaim1 = DoubleToStr(GD,0);
      if (MN<10) sTaim2 = StringConcatenate(sTaim2,"0"+DoubleToStr(MN,0));
      else sTaim2 = StringConcatenate(sTaim2,DoubleToStr(MN,0));
      if (DD<10) sTaim3 = StringConcatenate("0",DoubleToStr(DD,0));
      else sTaim3 = DoubleToStr(DD,0);
      sTaim=sTaim1+sTaim2+sTaim3;
   }
   return(sTaim);
}
 

I have noticed one specific feature of the terminal. Since the order profit calculation does not consider the OrderSwap(), I want it to close the order at once.


I.e. we have to use the following formula to close the order with a profit:

(OrderProfit()+OrderSwap()+OrderCommission())>0

I've never worked with commission and commission is not used on demo, that's why I can't check it on account.

Are my calculations correct?
Reason: