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

 
MakarFX #:
You have the "GetAveragePrice()" function

Make one for "max_ticket" and "min_ticket"

Here's Makar having a constructive conversation

 
EVGENII SHELIPOV #:

Here's Makar having a constructive conversation

It all depends on the correctness of the question.

EVGENII SHELIPOV # :

Help me change the code so that instead of Profit there are points. Thank you.

EVGENII SHELIPOV #:

My question was simple - instead of Profit in currency specify that min/max orders will close after breakeven point after a certain amount of pips

Can you feel the difference?

 
MakarFX #:
You have the average price function "GetAveragePrice()"

Make the same one, but only for "max_ticket" and "min_ticket"

Here it is time to address the audience I will formulate a question tomorrow and ask the forum members

 
MakarFX #:

It all depends on the right question being asked

Can you feel the difference?

Yes, maybe I haven't worked out the question and I've brought it up on the forum. I will formulate it more concretely tomorrow.

 

Someone explain why x in OnTick is always false even when foo2 returns true?

void OnTick(){
    bool x = foo();
}

bool foo2(){
    ...
    if(...) return true;
    else return false;
}

bool foo(){
    bool x = false;
    if(...) x = foo2(); 
    return x;
}
 
Nerd Trader #:

Can someone explain why x in OnTick is always false even when foo2 returns true???

Usually there's a logic error somewhere. Print each step.

 
Hello, can anyone suggest an article or experience how to implement OnCalculate in Expert Advisor?
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],

Trying to organise a calculation for all TFs.

HELP dear servants!
 
Mikhail Toptunov OnCalculate in Expert Advisor?

I am trying to organise a calculation across all the TFs.

HELP dear servants!

This can be done without OnCalculate

The OnCalculate() function is called only in custom indicators
 
Valeriy Yastremskiy #:

There is usually an error of logic somewhere. Print each step.

That's what I do. When foo2() returns true, observe it with the print.
 
Nerd Trader #:

Someone explain why x in OnTick is always false even when foo2 returns true?

If foo2 returns true, then look for an error here

bool foo(){
    bool x = false;
    if(...)  x = foo2(); 
    return x;
}
Reason: