Learning and writing together in MQL5 - page 7

 
ralexn:

Thanks....But...I'm a very beginner:)))

it's only hard for the first hundred years. it gets easier after that :)

read the help and see examples from MT

 
I see. So the trailing stop is not implemented in any way... I'll have to write it myself after all... :(
 
k2m писал(а) :
I see. So, trailing stop has not been implemented in any way. I will have to write it myself. :(

Why isn't it implemented? It's the same as always - right-click on the order and select trawl in the menu.

or write your own trawls. the only common solution for you is the standard MT trawl.

 

Gentlemen.
...
PrintFormat("Spread: %i, ask-bid: %i", (int)SymbolInfoInteger(_Symbol, SYMBOL_SPREAD), (int)((lastTick.ask - lastTick.bid) * MathPow(10, _Digits)));
Spread: 0, ask-bid: 55

55 may be different (pair, time), but 0 is always .
Thanks.

 
FlyAgaric:

Gentlemen.
...
PrintFormat("Spread: %i, ask-bid: %i", (int)SymbolInfoInteger(_Symbol, SYMBOL_SPREAD), (int)((lastTick.ask - lastTick.bid) * MathPow(10, _Digits));
Spread: 0, ask-bid: 55

55 may be different (pair, time), but 0 is always .
Thank you.

0 means the spread is floating, all right.
 
Valmars писал(а) :
Function description:

SymbolInfoInteger
Returns the corresponding property of the specified symbol.

1. Directly returns the value of the property.

long SymbolInfoInteger(
string name, // symbol
int prop_id // property identifier
);


SYMBOL_SPREAD Spread size in points int

I understand this f-iory returns value from ENUM_SYMBOL_INFO_INTEGER

I would like to understand what the developers wanted. It is not clear from the description.
Thank you.

 

longSymbolInfoInteger

function does not return ENUM_SYMBOL_INFO_INTEGER but specifically a number - spread value (if you mean SYMBOL_SPREAD).


Note

If the spread on the specified symbol is floating, the

SymbolInfoInteger(Symbol(),SYMBOL_SPREAD);

will return a null value.


So if you want to know the current spread - look at the difference between Bid and Ask

 
sergeev писал(а) :


long SymbolInfoInteger

function does not return ENUM_SYMBOL_INFO_INTEGER but specifically a number - spread value (if you mean SYMBOL_SPREAD).


Note

If the spread on the specified symbol is floating, the

SymbolInfoInteger(Symbol(),SYMBOL_SPREAD);

will return a null value.


so if you want to know the current spread - look at the difference of Bid and Ask

Thank you.
 
SHOOTER777 писал(а) # :

Briefly what I am trying to implement:

3) graphical display of position and trades of the current instrument on the chart, as well as info on all positions in the lower left corner

I like the MT5 more than MT4, but cannot solve the problem of automated display of history of deals on the chart in one step. Please help, either with a link to an automated solution of this problem, or if it is possible to remake the Expert Advisor into a script. Thank you very much in advance!

The original Expert Advisor can be found in the first post of this thread - https://www.mql5.com/ru/forum/58.

This is how it is implemented in MT4:
"Deal from history on a chart. View -> Terminal -> Account history. We grab the order and drag it to the chart. Of the same instrument (if you drop it on the chart of another instrument, it will be replaced by the selected one).
The order is displayed in the form of arrows for opening and closing the order, connected by a segment of a trend line. Stop Loss and Take Profit levels are displayed on the same vertical axis with the open price.
If you drag the order holding the Shift key, the chart will show the entire trading history for this symbol (believe me, it's very clear).

Изучаем и пишем вместе на MQL5
Изучаем и пишем вместе на MQL5
  • www.mql5.com
2) вывод всей возможной информации по инструментам, ордерам и др.
 

Would anyone be kind enough to suggest a solution to a small problem for a beginner.

First condition.

I have a Frakt Zigzag indicator written in 4.

After the use of the "automatic translator" in MQL5, I have managed to obtain some code which has some pretension to be called a "five" code.

Particularly "pleased" with these two parts:

// UPFRACTALS.

if (iFractals(NULL,0,MODE_UPPER, POS)!=0)

{

Fractal1B=iFractals(NULL,0,MODE_UPPER, POZ);

Fractal1B=POZ;

}

i=1 ;

while(i<40)

{

if (iFractals(NULL,0,MODE_UPPER, Fractals1B+i)!=0)

{

Fractal2B=iFractals(NULL,0,MODE_UPPER, POZFractal1B+i);

POZFractal2B=POZFractal1B+i ;

break;

}

i++ ;

}

i=1 ;

while(i<40)

{

if (iFractals(NULL,0,MODE_UPPER, Fractals2B+i)!=0)

{

Fractal3B=iFractals(NULL,0,MODE_UPPER, POZFractal2B+i);

POZFractal3B=POZFractal2B+i ;

break;

}

i++;

}

и

// DOWN FRACTALS

if (iFractals(NULL,0,MODE_LOWER, POS)!=0)

{

Fractal1H=iFractals(NULL,0,MODE_LOWER, POZ);

POZFractal1H=POZ;

}

i=1 ;

while(i<40)

When we try to compile, we get :

MODE_UPPER' - undeclared identifier FZR2 .mq5 164 37

MODE_LOWER' - undeclared identifier FZR2 .mq5 192 37

The second condition. Here is the code of the Fractals indicator that fills the buffers separately with the data of the upper and lower fractals. Here is part of its code:

if(prev_calculated<7)

{

limit=2;

//--- clean up arrays

ArrayInitialize(ExtUpperBuffer,0.0);

ArrayInitialize(ExtLowerBuffer,0.0);

}

else limit=rates_total-5;

for(i=limit;i<rates_total-3;i++)

{

//---- Upper Fractal

if(High[i]>High[i+1] && High[i]>High[i+2] && High[i]>=High[i-1] && High[i]>=High[i-2])

ExtUpperBuffer[i]=High[i];

else ExtUpperBuffer[i]=0.0;

//---- Lower Fractal

if(Low[i]<Low[i+1] && Low[i]<Low[i+2] && Low[i]<=Low[i-1] && Low[i]<=Low[i-2])

ExtLowerBuffer[i]=Low[i];

else ExtLowerBuffer[i]=0.0;

}

//--- OnCalculate done. Return new prev_calculated.

return(rates_total);

}

Question: Does these buffers (the buffers of the Fractals indicator) contain the data about time and price of the bar-fractal, and if "yes", how to write the loop, so that in the FZR indicator the buffers are filled with data from the buffers of the Fractals indicator?

Fractals
Fractals
  • votes: 8
  • 2010.01.26
  • MetaQuotes Software Corp.
  • www.mql5.com
Фракталы (Fractals) — это один из пяти индикаторов торговой системы Билла Вильямса, позволяющий обнаруживать дно или вершину.
Files:
fzr2.mq5  14 kb
fractals.mq5  4 kb