Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1609

 

Afternoon.

History is not improving in any way, history quality is 22% for all characters.

Tried everything, maybe something with the settings, but I don't seem to have touched anything much. Build 2981.

Maybe broker messes up?)

report

magazine

 
If you run it from Metaeditor, the quality is 9%. I didn't think they would go for "kitchens". It was enough to have an MT4 with leaky quotes on which it was impossible to optimise properly.
 
Hi, I urgently need an OSMA indicator with an alert at the moment of crossing the zero line, not at the close of the bar. I also need an alert that may be put a custom one. Do you have one? Please, share. If no - I will ask them to write it🙏
 
Manter84 #:
No viruses, but it's a mess. And then there's the double-tap.)

There's a lot of backtracking on the phone, a long-standing problem)

 
int cnt,ticket,total=0;

st = "часы общ. пон. вт. ср. чт. пт. \n";

double cHeight, gHeight, Max;

int sat, sun, mon, thu, wen, ths, fri; //, NN;

int H = TimeHour(TimeCurrent()); // определим текущий час

double NN = H + N*24; // определим смещение

if (NN>Bars) NN=Bars;

for (int t=0; t<24; t++)

{

  int HeightZ = 0; int z=0;

  for (int i=0; i<=NN; i++)

  {

    HeightZ = (High[i]-Low[i])/Point;

    z++;
  }

}

Write this function without errors into the built maxd advisor please. I can't get rid of this error 'undeclared identifier


 
Mihail Matkovskij (MathAbs were not needed).

и

here you are trying to calculate the number of bars... But it's better to set it as just a positive number, for starters.

You can calculate the average bar movement like this:

Now, you can try to calculate stop and take based on the result of the function.

Please show me an example of a simple Expert Advisor.

 
Valeriy Yastremskiy #:

The print will print on every tick and on the first load OnTick in EA and OnCalculate in indicator.

Strange that it does not print on subsequent ticks. check insert, if there are two prints with the same i, the question will be valid).

The i's are different. (i=1 and i=2).

 
Manter84 #:

i are different. (i=1 and i=2).

So in the body OnCalculate prints 1 time)

 

Can you tell me how to shorten the construction?

The point is to cut off pairs that already have a symbol in them

int OnInit()
{
  Comment(Search(Symbol())?"Yes":"No");
  return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
bool Search(string _sy)
{
  int OT=OrdersTotal();
  for(int i=0; i<OT; i++) {
    if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
        if(StringSubstr(OrderSymbol(),0,3)==StringSubstr(_sy,0,3) ||
           StringSubstr(OrderSymbol(),0,3)==StringSubstr(_sy,3,3) ||
           StringSubstr(OrderSymbol(),3,3)==StringSubstr(_sy,0,3) ||
           StringSubstr(OrderSymbol(),3,3)==StringSubstr(_sy,3,3))
         return(true);
    }
  }
  return(false);
}

I have a position on USDCHF

===

There is a position on EURGBP, the signal came from AUDUSD - how to detect that there is no position on either AUD or USD ?

 
Vitaly Muzichenko #:

Can you tell me how to shorten the construction?

The point is to cut off pairs that already have a symbol in them

There is a position on USDCHF pair


StringFind

I think there should be 2 strings, search and 0 and 3 positions. That would cut off a random match in the middle.

SZ

Stupid, there are 4 conditions.

Not equal A B and not equal C D

condition A==C or A==D or B==C or B==D

In short, I don't think anyone can write it)))