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

 
SteelKnight84:

Hello, gentlemen programmers.

I'm too lazy to look into the tutorial. Maybe you know what should be changed in your Expert Advisor so that it would apply the money management at 0.01, not 0.1


Everybody is too lazy
 
Vinin:

Everyone is lazy

It is one thing for a programmer who knows the language to be too lazy to open the program. It's another thing when a person who doesn't know the language is too lazy to learn the language to answer an essentially simple question. If knowing the language is a necessity for a programmer, it makes no sense for me to dive into it :) That's all. But of course, if no one answers, I have to. But what is the point of the forum then, if only programmers communicate here?
 
SteelKnight84:

It is one thing for a programmer who knows the language to be too lazy to open a program. It's another thing when a person who doesn't know the language is too lazy to learn the language to answer an essentially simple question. If knowing the language is a necessity for a programmer, it makes no sense for me to dive into it :) That's all. But of course, if no one answers, I have to. But what is the point of this forum if only programmers communicate here?

If there is no point - do not ask questions but directly here
 
Vinin:

If it doesn't make sense, don't ask questions and come straight here

Thank you.
 
SteelKnight84:

Hello, gentlemen programmers.

I'm too lazy to look into the tutorial. Maybe you know what should be changed in your Expert Advisor so that it would apply the money management at 0.01, not 0.1


I changed 2 digits, see if it works as it should.

Files:
 

Is there an option to mark the entire forum as read?

And also the MQL5 forum...

Thank you

 
ALXIMIKS:


changed 2 digits, see if it works as it should.


Turns out someone's not lazy. I made a mistake.
 

Hello everyone!!! Thank you all for the sound advice. But I still haven't been able to make any progress on what I started)) My EA opens two identical orders and the rest are against the movement, I want to change it to open on the movement!!! I have tried all the variants.

PLEASE ADVISE WHO CAN

string GLOB_START;

int init()
{
GLOB_START = "@" + DoubleToStr(ID,0) + "@" +"_start";
if !GlobalVariableCheck( GLOB_START )GlobalVariableSet(GLOB_START,TimeCurrent());
return(0);
}

int deinit()
{
switch( UninitializeReason() )
{
case REASON_REMOVE: delete_glob ("@" + DoubleToStr(ID,0) + "@" );
}
if ( IsTesting() )delete_glob ("@" + DoubleToStr(ID,0) + "@" );
return(0);
}

void delete_glob ( string c )
{
int i;
for ( i = GlobalVariablesTotal()-1; i>= 0 ; i-- )if ( StringFind(GlobalVariableName(i),c) >= 0 )GlobalVariableDel(GlobalVariableName(i))
}

int start()
{
Comment(Info());
int KOL_BUY = order_total(0);
int KOL_SELL = order_total(1);
double l;

if ( order_total() == 0 )
{
open(0,Lot,0,TP);
open(1,Lot,0,TP);
}

if ( KOL_BUY == 0 && KOL_SELL != 0 )
{
open(0,Lot,0,TP);
l = last_trade(1);
open(1,l,0,0);
modify_orders(1);
}

if ( KOL_BUY != 0 && KOL_SELL == 0 )
{
open(1,Lot,0,TP);
l = last_trade(0);
open(0,l,0,0);
modify_orders(0);
}

return(0);
}

string Info()
{
int i;
double buff_1 = 0, buff_2 = 0, buff_3 = 0;
string res = "\n";

for( i = OrdersHistoryTotal() - 1; i >= 0; i-- )
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if( OrderMagicNumber() == ID )
{
if ( OrderOpenTime() >= iTime(NULL,PERIOD_D1,0) )buff_1 += OrderProfit();
if ( OrderOpenTime() >= iTime(NULL,PERIOD_D1,1) && OrderOpenTime() < iTime(NULL,PERIOD_D1,0) )buff_2 += OrderProfit();
if ( OrderOpenTime() >= GlobalVariableGet(GLOB_START) )buff_3 += OrderProfit();
}
}

res = res + "Profit in the deposit currency for " + TimeToStr(iTime(NULL,PERIOD_D1,0)) + ": " + DoubleToStr(buff_1,0) + "\n" + "\n";
res = res + "Profit in deposit currency for " + TimeToStr(iTime(NULL,PERIOD_D1,1)) + ": " + DoubleToStr(buff_2,0) + "\n" + "\n";
res = res + "Profit in the deposit currency total:" + DoubleToStr(buff_3,0) + "\n";
return(res);
}

void modify_orders( int type )
{
int i;
datetime time_last = 0, time_first = TimeCurrent();
double SPREAD = MarketInfo(Symbol(),MODE_SPREAD)*MarketInfo(Symbol(),MODE_POINT), op_pr_last, op_pr_first, level;

for( i = OrdersTotal() - 1; i >= 0; i-- )
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if( OrderMagicNumber() == ID && OrderType() == type )
{
if ( OrderOpenTime() > time_last )
{
op_pr_last = OrderOpenPrice();
time_last = OrderOpenTime();
}
if ( OrderOpenTime() < time_first )
{
op_pr_first = OrderOpenPrice();
time_first = OrderOpenTime();
}
}
}


if ( type == 0 )level = op_pr_last + MathAbs(op_pr_last-op_pr_first) * (SL/100);
if ( type == 1 )level = op_pr_last - MathAbs(op_pr_last-op_pr_first) * (SL/100);

for( i = OrdersTotal() - 1; i >= 0; i -- )
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if( OrderMagicNumber() == ID && OrderType() == type && NormalizeDouble(OrderTakeProfit(),Digits) != NormalizeDouble(level,Digits) )OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),level,0)
}
}

double last_trade( int t )
{
int i;
double res = -1;
datetime time=0;

for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderOpenTime()>time && OrderMagicNumber()==ID && OrderType() == t)
{
res = OrderLots();
time = OrderOpenTime();
}
}
if ( multiplier )return(res * Lot_koeff);
if ( !multiplier )return(res + Lot_koeff);
}
int open(int type, double l, double sl=0, double tp=0, string comm = "")
{
int isOpened = 0, try = 0;
double s,t;
while ( IsTradeContextBusy() ){Sleep(500);}
RefreshRates();
if ( sl != 0 && sl < MarketInfo(Symbol(),MODE_STOPLEVEL) )sl = MarketInfo(Symbol(),MODE_STOPLEVEL);
if ( tp != 0 && tp < MarketInfo(Symbol(),MODE_STOPLEVEL) )tp = MarketInfo(Symbol(),MODE_STOPLEVEL);
if ( type == 0 )
{
if ( tp == 0 )t = 0;
if ( tp != 0 )t = Ask + tp * Point;
if ( sl == 0 )s = 0;
if ( sl != 0 )s = Bid - sl * Point;
}
if ( type == 1 )
{
if ( tp == 0 )t = 0;
if ( tp != 0 )t = Bid - tp * Point;
if ( sl == 0 )s = 0;
if ( sl != 0 )s = Ask + sl * Point;
}
s = NormalizeDouble(s,Digits);
t = NormalizeDouble(t,Digits);
if(type==0)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Ask,Digits),10,s,t,comm,ID);
if(type==1)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Bid,Digits),10,s,t,comm,ID);
Sleep(500);
while(isOpened<0)
{
while ( IsTradeContextBusy() ){Sleep(500);}
RefreshRates();
if ( type == 0 )
{
if ( tp == 0 )t = 0;
if ( tp != 0 )t = Bid + tp * Point;
if ( sl == 0 )s = 0;
if ( sl != 0 )s = Bid - sl * Point;
}
if ( type == 1 )
{
if ( tp == 0 )t = 0;
if ( tp != 0 )t = Ask - tp * Point;
if ( sl == 0 )s = 0;
if ( sl != 0 )s = Ask + sl * Point;
}
s = NormalizeDouble(s,Digits);
t = NormalizeDouble(t,Digits);
try++;
if(type==0)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Ask,Digits),10,s,t,comm,ID);
if(type==1)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Bid,Digits),10,s,t,comm,ID);
if(try > 5) break;
if(isOpened>=0)break;
Sleep(500);
}
if(isOpened<0) Alert("Order not opened, error :", GetLastError());
return(isOpened);
}

int order_total( int type_1 = -1, int type_2 = -1 )
{
int i;
int kol=0;
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderMagicNumber()==ID && (OrderType() == type_1 || OrderType() == type_2) )kol++;
if(OrderMagicNumber()==ID && type_1 == -1 && type_2 == -1 )kol++;
}
return(kol);
}

double check_lot(double &lo)
{
double l = MarketInfo(Symbol(),MODE_LOTSTEP);
int ok = 0;
while ( l < 1 ){l*=10;ok++;}
if( lo < MarketInfo(Symbol(),MODE_MINLOT) )lo = MarketInfo(Symbol(),MODE_MINLOT);
if( lo > MarketInfo(Symbol(),MODE_MAXLOT) )lo = MarketInfo(Symbol(),MODE_MAXLOT);
return(NormalizeDouble(lo,ok));

 

Can you suggest the following thing, there are N EAs on the account, which under certain conditions can all open an order at the same time, each of them checks no more than 1 order on the account, but sometimes I end up with N orders, what can I do?

 
beginner:

Can you suggest the following thing, there are N EAs on the account, which under certain conditions can all open an order at the same time, each of them checks no more than 1 order on the account, but sometimes I end up with N orders, what can I do?


Contact them, they will probably guess the reason and remotely suggest a solution ;)
Reason: