[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 407

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
BASE FLETCHING... :-)
and also a BASE TREND ))
if eur goes down and dol goes down, flat
:-)
have swap spreads been factored into the thinking?
On the fact that after the for...
Yeah.... "Exhaustive" answer. Every event has to have a reason. Professionals, encountering some malfunctions know what to pay attention to. Looked through the algorithm several times, but I can not find the cause That's why I turn to the pros for advice - what could be the reason?
I am trying to open a pending order like this:
//+---------Функция расчета лота---------------------------------------+
double GetLot(int Risk)
{
double Free=AccountFreeMargin();
double One_Lot=MarketInfo(Symbol(),MODE_MARGINREQUIRED);
double Min_Lot=MarketInfo(Symbol(),MODE_MINLOT);
double Max_Lot=MarketInfo(Symbol(),MODE_MAXLOT);
double Step=MarketInfo(Symbol(),MODE_LOTSTEP);
double Lot=MathFloor(Free*Risk/100/One_Lot/Step)*Step;
if(Lot<Min_Lot)Lot=Min_Lot;
if(Lot>Max_Lot)Lot=Max_Lot;
if(Lot*One_Lot>Free)return(0.0);
return(Lot);
}
//+----------Функция открытия ордера-----------------------------------+
int NewOrder(int Cmd,double Lot)
{
double TP=0;//takeprofit
double SL=0;// stop loss
double PR=0;// price
while(!IsTradeAllowed())Sleep(100);
if(TakeProfit<MarketInfo(Symbol(),MODE_STOPLEVEL))
TakeProfit=MarketInfo(Symbol(),MODE_STOPLEVEL);
if(StopLoss<MarketInfo(Symbol(),MODE_STOPLEVEL))
StopLoss=MarketInfo(Symbol(),MODE_STOPLEVEL);
if(Cmd==OP_BUYSTOP)
{
PR=NormalizeDouble(Ask,Digits);
if(TakeProfit>0)TP=NormalizeDouble(Ask+TakeProfit*Point,Digits);
if(StopLoss>0)SL=NormalizeDouble(Bid-StopLoss*Point,Digits);
}
if(Cmd==OP_SELLSTOP)
{
PR=NormalizeDouble(Bid,Digits);
if(TakeProfit>0)TP=NormalizeDouble(Bid-TakeProfit*Point,Digits);
if(StopLoss>0)SL=NormalizeDouble(Ask+StopLoss*Point,Digits);
}
tic=OrderSend(Symbol(),Cmd,Lot,PR,3,SL,TP,"",0,0,CLR_NONE);
if(tic<0)Print("Error opening order:",GetLastError()); Print("Cmd-",Cmd, "Lot=",Lot, "PR=",PR, "SL=",SL, "TP=",TP);
return(tic);
}
When I check it, I get a message:
2011.12.06 23:36:50 2010.01.06 16:19 Big Dog 1.01 EURUSD,M15: invalid lots amount for OrderSend function
2011.12.06 23:36:50 2010.01.06 16:19 Big Dog 1.01 EURUSD,M15: OrderSend error 4051
2011.12.06 23:36:51 2010.01.07 17:20 Big Dog 1.01 EURUSD,M15: Faulty order open:405
2011.12.06 23:36:51 2010.01.07 17:20 Big Dog 1.01 EURUSD,M15: Cmd-5Lot=0PR=1.4316SL=1.4419TP=1.4216
Obviously, it is something with the calculation of lots, but I do not understand what))) Please advise
Yep.... "Exhaustive" answer. Every event has to have a reason. Professionals, when encountering some malfunction, know what to look out for. I looked through the algorithm several times, but cannot find the reason. That's why I'm asking the pros for advice - what may be the reason?
Well, where is the indicator?! (I'm guessing by coffee grounds tel. https://www.mql5.comhttps://www.mql5.com/ru/)
Well if you list everything, the letters will run out.
continue break return see if and when there is an interrupt for and when it happens. works with the opening of the bar....
"encountering some problems know what to pay attention to" they don't pay attention but start debugging, start debugging your indicator too, e.g. via print (moreover with someone else's and so 15 pages long, more than 50 called functions...)
Hello.
I have created an array:
However, for some reason its first value goes to zero (-10.09 becomes 0). I found a way out of the situation by doing this:
Can you please tell me what this is about? Very much I want to understand.
Thank you in advance.
Hello.
I have created an array:
However, for some reason its first value goes to zero (-10.09 becomes 0). I found a way out of the situation by doing this:
Can you please tell me what this is about? Very much I want to understand.
Thank you in advance.
I have not zeroed with index = 0
2011.12.06 20:00:47 MA_TF AUDUSD,M30: Alert: -10.09
Here is the problematic part of the code:
Here is the problem described above: the line derived from the value -10.09 is not drawn (it takes the value of MinAsia).
Here's the problematic part of the code:
tuz
I am trying to open a pending order like this:
//+---------Функция расчета лота---------------------------------------+
When I check it, I get a message:
2011.12.06 23:36:50 2010.01.06 16:19 Big Dog 1.01 EURUSD,M15: invalid lots amount for OrderSend function
2011.12.06 23:36:50 2010.01.06 16:19 Big Dog 1.01 EURUSD,M15: OrderSend error 4051
2011.12.06 23:36:51 2010.01.07 17:20 Big Dog 1.01 EURUSD,M15: Faulty order open:405
2011.12.06 23:36:51 2010.01.07 17:20 Big Dog 1.01 EURUSD,M15: Cmd-5Lot=0PR=1.4316SL=1.4419TP=1.4216
Obviously, it is something with the calculation of lots, but I do not understand what))) Please advise