[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 248

 
paladin80:
Maybe you want to compare the current price with the closing price on the previous bar?
Hmm, perhaps you are more precise than I am :)
 
int start()
  {
 double current_price=Bid;
 double past_bar=High[1];//Любое из предопределенных переменных
 if(past_bar<Bid){/*.........*/}
 if(past_bar>Bid){/*.........*/}
 Comment("past_bar = ",past_bar,"\n",
         "Bid = ",Bid);
   return(0);
  }
somehow)
 
deyron:
somehow)
Thank you for your help! I have a question - how will the program know that High[1] is the previous value?
 
One is the first bar (closed) [1], if you want it on the fifth bar then [5], etc.
 
skyjet:
Thank you for your help! I have a question - how will the program know that High[1] is the previous value?

You can go like this.

if (Bid > iHigh[1])
{
Comment ("Текущая цена больше максимума предыдущей [1] свечи")
}
if (Bid < iHigh[1])
{
Comment ("Текущая цена меньше максимума предыдущей [1] свечи")
}
 
Dear programmers, please answer me the following question: EA opens n number of orders on M1, according to indicator signals and depending on trend direction. A signal to close orders is received and the strategy is reversed. Orders with profit are being closed successfully and negative ones are being held up until better times. Orders of the opposite direction are piled up and the "lucky" ones from the previous series are simultaneously closed at breakeven. Then the moment comes when the amount of orders of opposite directions is compared and this is when I, as a manager, start a cleaning action that immediately clears the terminal of all orders and the cycle repeats. There are times when the orders are not piled up, for example, during a flat, but the described situation is not uncommon and if we miss it, we may get a dangerous drift. Question: Can I stipulate in my EA that this procedure should be done automatically? For one thing evaluate my "innovation" or criticize it constructively or indicate the source, where this strategy is used and what are the results, because I have already prepared a suitcase for the green, I rake them all out of the market, nobody should suffer. Thanks in advance.
 
deyron:


This is the code you need )))). (just kidding).

Look, we have a code in which there is a place where drawing of graphical objects is prescribed, in the same function is described the transfer of values to the buffer. If graphical objects are drawn, then the value should be transferred to the buffer and then to the Expert Advisor. Do I understand it or not? With what delay do these values come to the Expert Advisor or instantly?


You can't tell anything without the full code of the indicator.
 
yosuf:
Dear programmers, please answer my question: ...
Well, perhaps we need to create a condition where the EA counts open losing positions Buy, then counts open losing positions Sell and when their number is equal to each other, all positions are closed. The main thing is the accuracy of the algorithm.
 
paladin80:

You can go like this

Thank you :)
 
You know, I can't overwrite an archive with zip extension into rar. I right click on the archive - in the menu pyryminate - a window lights up, you can write there whatever you want, but the archive type is saved.
Reason: