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

 

Good afternoon. When trying to draw Fibonacci levels on a chart like this:

if(!ObjectCreate("",OBJ_FIBO,0,time_1,price_1,time_2,price_2))
    {
    Print("ObjectCreate(Fibo_1) вернул ошику: ",GetLastError());
    }
  ObjectSet("Fibo_1",OBJPROP_COLOR,DeepPink);
  ObjectSet("Fibo_1",OBJPROP_FIBOLEVELS,6);
  ObjectSet("Fibo_1",OBJPROP_FIRSTLEVEL+0,Level_1);
  ObjectSet("Fibo_1",OBJPROP_FIRSTLEVEL+1,Level_2);
  ObjectSet("Fibo_1",OBJPROP_FIRSTLEVEL+2,Level_3);
  ObjectSet("Fibo_1",OBJPROP_FIRSTLEVEL+3,Level_4);
  ObjectSet("Fibo_1",OBJPROP_FIRSTLEVEL+4,Level_5);
  ObjectSet("Fibo_1",OBJPROP_FIRSTLEVEL+5,Level_6); 
I get an error 4200 when testing, although initially there are no Fibonacci levels and all old graphic objects are deleted at the beginning of the code when checking the time:
if(Hour()==HourA && Minute()==0 && Seconds()==0)
  {
   datetime time_1=TimeCurrent();
   ObjectsDeleteAll(0,-1); 
   ObjectCreate("vline_1",OBJ_VLINE,0,TimeCurrent(),0);
  }
What is the problem, no one can explain?
 
Vinin:
double sum=0;
sum+=iMa(NULL, 0, N, 0, MODE_SMA, PRICE_CLOSE, 0); // count the average close price
sum-=iMa(NULL, 0, N, 0, MODE_SMA, PRICE_OPEN, 0); // subtract the average open price sum*=N;

Elegant of course... There was such, unformed, thought. But it doesn't look quite right. MA is still an average of N periods, while I just need the sum. Or am I wrong?
 
001:


1. Yes

2. What are opening deals? Maybe you don't have a CLOSE condition?


excuse me - buy trades
 

So the second question remains open:

2) I wrote a fairly simple martingale-based EA, in the tester it works fine, but when I run it on live charts, it only opens buy trades (although today I also opened a sell trade, but still not the same as in the tester)... What is the reason? Why is the EA working fine in the Strategy Tester but poorly on demo charts? The code is exactly the same

to sum it up: may the EA work differently in the Strategy Tester and in real life?

 
CLAIN:

To summarise: can an EA work differently in the tester and in life?


Yes
 
001:

Elegant of course... I had that thought in my head. But it doesn't seem quite right to me. MA is, after all, the average for N periods, and I just want the sum. Or am I wrong?

If the arithmetic is bad, then you can twist it. But on your own
 
Hello. I have this question. When using DDE, is it possible to query the terminal from Excel to find out the account status, i.e. ask for "Balance", "Equity", etc. or is it possible to send only quotes via DDE?
 
Gerkl:
Hello. I have this question. When using DDE, is it possible to make a query from Excel to the terminal to find out the account status, i.e. ask for "Balance", "Equity" etc. or is it possible to send only quotes via DDE?

Hi. The answer to your question about DDE Query Formats can be found here: https://forum.mql4.com/ru/27755
 
Vinin:

If your arithmetic isn't good, you can get twisted. But on your own...


sum*=N;

I didn't get it right away, I apologise. I'm tired already before the new year. I'm having a hard time figuring it out. Thank you very much. Happy New Year.

 
Figar0:

Yes

how's that? Is there any solution to this problem? How am I supposed to check everything on the tester if the tester results leave a lot to be desired?
Reason: