Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1101

 
Sepulca:

From the documentation about OrderSend():

.......

Returned value

Returns ticket number assigned to the order by the trade server or -1 in case of failure. To get the error information, call GetLastError().

My point exactly... Ticket number can not be 0 even in the tester, and in case of error function returns -1, which is less than 0. So I asked, in what case the ticket may be equal to zero... Because the condition says >= i.e. greater than or equal to...
 
h-l


Can you tell me if there is an indicator for mt4 that counts volatility on the selected timeframe?

For example for days( H-L)n, where n-number of days.

 
lempopo:


Can you advise if there is an indicator for MT4 that calculates the volatility on a selected timeframe?

For example for days( H-L)n, where n-number of days.

Is it volatility?

"Volatility is a statistical measure of the trend in price volatility." - That's about what the definition sounds like.

Historical volatility is a value equal to the standard deviation of a financial instrument's value over a given period of time, calculated on the basis of historical data about its value.

And as an indicator of volatility in the terminal there is an indicator of standard deviation - Standard Deviation.

 
AlexeyVik:
That's what I'm saying... Ticket number can not be 0 even in the tester, and on error function returns -1, which is less than 0. So I asked, in what case the ticket can be equal to zero... Because the condition says >= i.e. greater than or equal to...

With the ticket everything is clear.I have a function to determine the last open order (according to the ticket) even by OrderTupy divided.guys the question is as follows.complimator does not give out errors and in the tester no errors but the order is not modified....why????? if I can not understand my error I can not realize it

if(OrderSend(Symbol(),OP_BUYLIMIT,0.10,Ask,Slippage,0,0, "first buy order set",Magik,0)== true)

{
TicketB = FindLastTicket(OP_BUY);
if(TicketB >0)
{
SL = priseBuy + NormalizeDouble(takeP1 * Point,Digits);
TP = priseBuy - NormalizeDouble(stopL1 * Point,Digits);
if(OrderModify(TicketB,priseBuy,SL,TP,0)== true)
Comment("hooraaaahhhh");
}
 

Where can I find a wizard who can write a small script to try it out for free?

 
burbur87:

I have the function of determining the last open order (by ticket) even by OrderTupy.guys the question is this: the complimator does not give out errors and in the tester no errors but the order is not modified....why????? if I can not understand my error I can not realise it


if(OrderSend(Symbol(),OP_BUYLIMIT,0.10,Ask,Slippage,0,0,"первый ордер бай установлен",Magik,0)== true)
      { 
          TicketB = FindLastTicket(OP_BUY);
          if(TicketB >0)
          {
             SL = priseBuy + NormalizeDouble(takeP1 * Point,Digits);
             TP = priseBuy - NormalizeDouble(stopL1 * Point,Digits);
             if(OrderModify(TicketB,priseBuy,SL,TP,0)== true)
             Comment("урааааааа");
            
          }

Use the SRC button in the panel above the text entry window.

Basically: just because the compiler doesn't throw errors doesn't mean anything. You need to check the log for any errors, and print the conditions and parameters. These are general recommendations.

Exactly on your code: the OrderSend() function returns the ticket number or -1 in case of errors. If you carefully read the documentation for data types, particularly the bool type, you can understand that false value is 0. Everything else is true. Therefore, no matter how the OrderSend() function terminates, the boolean value will always be true.

In the above example, there is no need to search for a ticket order using an additional function, since it will be returned by OrderSend().

Limit orders are not placed at the current price. What kind of modification are we talking about if the order should not be opened by such a command?

 
virginvl:

Where can I find a wizard to write a small script to try it out for free?


On any forum a few topics with offers to write for free. People learn how to write ...
 
virginvl:   Where can I find a wizard to write a small script to try out for free?

The wizard is in MetaEditor: File --> Create. What should the script do? Come on, let's write it together!!! I'll explain it step by step...


 
AlexeyVik:

Use the SRC button in the panel above the text entry window.

In essence: The fact that the compiler does not generate errors does not mean anything. You should check the log for any errors, and print the conditions and parameters. These are general recommendations.

Exactly on your code: the OrderSend() function returns the ticket number or -1 in case of errors. If you carefully read the documentation for data types, particularly the bool type, you can understand that false value is 0. Everything else is true. Therefore, no matter how the OrderSend() function terminates, the boolean value will always be true.

In the above example, there is no need to search for a ticket order using an additional function, since it will be returned by OrderSend().

Limit orders are not placed at the current price. What kind of modification are we talking about if the order should not be opened by such a command?


And the tester opened a position... Moreover, this order was like a flag that would later open a grid...

void OnTick()

{

if(trend == 1)

Comment("Within seven months, the trend is set to buy");

else Comment("trend is down for seven months");

double priseBuy = FindLastOrderPrise (OP_BUY);

double priseSel = FindLastOrderPrise (OP_SELL);


double frezeelevl = MarketInfo(OrderSymbol(),MODE_FREEZELEVEL);

rsi = iRSI(Symbol(),PERIOD_D1,7,PRICE_CLOSE,0);

trend = WhatTrend();

if (CountTrades() == 0)

{

if(trend == 1 && rsi <=30)

{ double vtoroilimt = NormalizeDouble (priseBuy - Vtoroilimit * Point,Digits);

double tretiilimit = NormalizeDouble (priseBuy - Tretiilimit * Point,Digits);

double hetvertiilimit = NormalizeDouble (priseBuy - Hetvertiilimit * Point,Digits);

double pervstop = NormalizeDouble (priseBuy + Pervstop * Point,Digits);

double vtoroistop = NormalizeDouble (priseBuy + Vtoroistop * Point,Digits);

if(OrderSend(Symbol(),OP_BUYLIMIT,0.04,Ask,Slippage,0,0, "first buy order set",Magik,0)== true)

{

OrderSend(Symbol(),OP_BUYLIMIT,0.06, Ask - vtoroilimt,Slippage,0,0,",Magik,0);

OrderSend(Symbol(),OP_BUYLIMIT,0.08, Ask - tretiilimit,Slippage,0,0,",Magik,0);

OrderSend(Symbol(),OP_BUYLIMIT,0.10,Ask - hetvertiilimit,Slippage,0,0,",Magik,0);

OrderSend(Symbol(),OP_BUYLIMIT,0.02,Ask - pervstop,Slippage,0,0,",Magik,0);

OrderSend(Symbol(),OP_BUYLIMIT,0.01,Ask - vtoroistop,Slippage,0,0,",Magik,0);

}

}// if(trend == 1 && rsi <=30)

else if(trend == 2 && rsi >= 70)

{ double vtoroilimt = NormalizeDouble (priseSel + Vtoroilimit * Point,Digits);

double tretiilimit = NormalizeDouble (priseSel + Tretiilimit * Point,Digits);

double hetvertiilimit = NormalizeDouble (priseSel + Hetvertiilimit * Point,Digits);

double pervstop = NormalizeDouble (priseSel - Pervstop * Point,Digits);

double vtoroistop = NormalizeDouble (priseSel - Vtoroistop * Point,Digits);

if(OrderSend (Symbol(),OP_SELLLIMIT,0.04,Bid,Slippage,0,0, "first order is set",Magik,0)== true)

{

OrderSend(Symbol(),OP_SELLLIMIT,0.06, Bid + vtoroilimt,Slippage,0,0,",Magik,0);

OrderSend(Symbol(),OP_SELLLIMIT,0.08, Bid + tretiilimit,Slippage,0,0,",Magik,0);

OrderSend(Symbol(),OP_SELLLIMIT,0.10,Bid + hetvertiilimit,Slippage,0,0,",Magik,0);

OrderSend(Symbol(),OP_SELLSTOP,0.02,Bid + pervstop,Slippage,0,0,",Magik,0);

OrderSend(Symbol(),OP_SELLSTOP,0.01,Bid + vtoroistop,Slippage,0,0,",Magik,0);

}// if(OrderSend(Symbol(),OP_SELLLIMIT,0.10,Bid,Slippage,0,0, "first order is set",Magik,0)== true)


}// else if(trend == 2 && rsi >= 70)

}// if(CountTrades() == 0)


}

//+------------------------------------------------------------------+

the code grows with a lot of agony.but without order modification there is nowhere at all.i will modify the first order.but what is the cp button???

 

I have been trying to program for a month. before that I spent a month taking a Mql4 tutorial and watching XBMS video tutorials. he gave a visual guide on how to modify. but even blindly repeating it does not modify the order