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

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
extern int MartinStep = 2;
extern double LOT = 0.01;
double GetLot(){
int time = 0;double profit = 0; double lots = 0; double Lot = 0;for(int i = OrdersHistoryTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)){
if(OrderSymbol() == Symbol()&& OrderMagicNumber() == Magic){
if(time<OrderCloseTime()){
time=OrderCloseTime();
profit=OrderProfit();
lots = OrderLots();
}
}
}
}
if(profit == 0 &&time == 0)
{
Lot = LOT;
}
if(profit >= 0)
{
Lot = LOT;
}
if(profit < 0 )
{
Lot = NormalizeDouble (lots*MartinStep,2);
}
return(Lot);
}
lots = OrderLots();
Lot = NormalizeDouble (lots*MartinStep,2);Either I have never got to operator lots = OrderLots(); and lots still remain =0. Or lots*MartinStep exceeded maximal allowed lot size.
I figured it out, the error is here
Hi all! Can you tell me how to implement EA re-initialization at the end of the day? Well, in init() there are some actions that need to be repeated at a certain time. I don't want to rewrite them in start(). I am more interested in the theoretical possibility of restarting the EA. Thank you in advance.
Hi all! Can you tell me how to implement EA re-initialization at the end of the day? Well, in init() there are some actions that need to be repeated at a certain time. I don't want to rewrite them in start(). I am more interested in the theoretical possibility of restarting the EA. Thank you in advance.
Would you please tell me if the flags and static variables are reset or remain in the EA's memory when restarting the EA (remove it from the chart and then put it back on again)?
During initialization everything is reset, except Global Variables
Everything is reset during initialisation except Global Variables
Everything is reset during initialisation except Global Variables