[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 39

 
Cod:

And here, the GA is increasing the number of runs? Is that possible?

Oops!

Extremely interesting case...)

 
DhP:

Whoa!

Extremely interesting case...)


No more options than possible
 

Thank you, I looked it up but didn't understand anything. For example:

A trade is not executed if any of the specified requirements is violated

SellLimit

1) OpenPrice-Bid StopLevel

2) SL-OpenPrice ≥StopLevel(further in the example)

3) OpenPrice-TP ≥ StopLevel

What does "Trading operation is not executed" mean? If a pending order is not placed (accepted) or if it is already placed, it does not trigger (what happens to it - is it deleted by the broker)? I repeat the question, if conditions have changed and a successfully placed order an hour later for example has SL-OpenPrice in changed by that moment StopLevel, what will happen to it?

And another question. Suppose the spread was 2 and it has become 7 points. What does it mean - has the bid or ask price changed, or does the broker select it arbitrarily as he sees fit?

 

When trying to compile a include file (*.mqh) an error '\end_of_program' - no function defined. What's wrong and how to fix it?

extern double Lots = 0.0;
extern int Percent = 0;
extern int StopLoss = 100;
extern int TakeProfit = 40;
extern int TrailngStop = 100;

int Level_New;
int Level_Old;

 

I looked at the cover of the STUDY book from all sides and still don't understand anything...))

I see it written like this everywhere:

int Ticket = OrderSend(...);

Is the below writing fair if I want to get Price = OrderOpenPrice() for further processing and setting Stops?

double Price = OrderSend(...);

It works for me, but is this acceptable?

 
Vinin:

No built-in functions, you just need to write your own wizard with calculation period depending on the timeframe
No problem... But how to determine the current value of TF in the code?
 

Good day to you all!

Writing for the first time, if something is wrong, sorry.

Question, why function (see below) gives error: 'A' - array item cannot be assigned?

double get_init_values(double A[], int index){

int size = 0;

size = ArraySize(A);

if (size < index){

return (0);

}else{

A [index] = Ask;

return (A);
}

}
Thanks in advance!
 
Saltan:

When trying to compile a include file (*.mqh) an error '\end_of_program' - no function defined. What's wrong and how to fix it...?

You don't have to try! The .mqh files are placed in include and they just lie there quietly. When you compile the EA in which they are written, the compiler automatically joins the necessary code elements and compiles them together.
When you try to separately compile .mqh, the compiler tries to determine the type of the product (Expert Advisor, indicator...) and starts to ask "where have you started?
You should start to deal with .mqh if errors occur during proper compilation.
 

I have inserted a new block in my EA to calculate the lot size of the position to be opened. The idea is as follows:

1. The stop is set to the High of the current day in case of a Sell position, and to the Low of the day in case of a Buy position.

2. When the condition for opening of the order triggers, this block for lot calculation starts to be executed. The distance to the High/ Low of the day in points is calculated and I loop through the lots starting from 0.1 to find the needed lot (5% when a stop has triggered)

But in the log these lines appear:

2011.01.30 16:59:47 TestGenerator: unmatched data error (volume limit 1107 at 2011.01.13 14:45)

As soon as I turn off this unit, everything is OK. Where am I wrong? Please advise.

Here is the code itself:

double Balance = AccountBalance();
    double DistanceToHighDay = MathAbs(HighDay-Ask)*10000;
    double DistanceToLowDay  = MathAbs(Bid-LowDay)*10000;
    double ExpectedSellLoss;
    double ExpectedBuyLoss;
    double ExpectedSellRisk;
    double ExpectedBuyRisk;
    double LotSell;
    double LotBuy;
    int     Risk = 5;
   
    // Расчёт лота для Sell
    for(int i=0.1; ExpectedSellRisk<Risk; i=i+0.1)
       {
        ExpectedSellLoss = DistanceToHighDay*i*10;         // ожидаемый убыток в $
        ExpectedSellRisk = (ExpectedSellLoss*100)/Balance; // ожидаемый убыток в %
        LotSell=i;
       }
       
    // Расчёт лота для Buy
    for(i=0.1; ExpectedBuyRisk<Risk; i=i+0.1)
       {
        ExpectedBuyLoss = DistanceToLowDay*i*10;         // ожидаемый убыток в $
        ExpectedBuyRisk = (ExpectedBuyLoss*100)/Balance; // ожидаемый убыток в %
        LotBuy=i;
       }
 
I'm learning mql4, I can't write a simple volume indicator, i.e. it calculates how many ticks are in each bar, if anyone has one, please share it. If someone specifically write it, thank you very much.