Good afternoon, this robot does exactly what I was looking for! I have a question, how do I make it so that new orders are inserted every time one is finalised, and not just when a new bar is born, I'm trading an asset that repeats the same price several times and I could do more than one trade per minute. thanks in advance.
Sorry, this code only works when the new bar is born.
Sorry, this code only works when the new bar opens.
Here my batch is every 1. If I want the batch to add +1 (1,2,3,4,5....) with each order, is this the section I need to change?
//--- get minimal step of volume changing
double volume_step=m_symbol.LotsStep();
int ratio=(int)MathRound(volume/volume_step);
if(MathAbs(ratio*volume_step-volume)>0.0000001)
What would that look like?
No Wrong To increase the current batch, you need to know what the last transaction was.
How can I limit the number of open orders?
Thank you
How can I limit the number of open orders?
Thank you
To limit - you need to count all POSITIONS.
The author of the Expert Advisor will not answer anyway. If it is possible to understand the code, someone at least answer on what principle pending limit orders are placed. It seems to be on the lag from the price, but on what principle and where in the code it can be regulated, if possible. Even without adjustment, just to understand how and under what conditions they are placed.
Hello, Vladimir!
In this block you can adjust/change the code highlighted in yellow as you need:
//--- MqlRates rates[]; ArraySetAsSeries(rates,true); int copied=CopyRates(m_symbol.Name(),Period(),1,1,rates); if(copied!=1) { PrevBars=0; return; } double H4=((((rates[0].high-rates[0].low)*1.1)/2)+rates[0].close); double H3= ((((rates[0].high-rates[0].low)*1.1)/4)+rates[0].close); double L3= (rates[0].close-((rates[0].high-rates[0].low)*1.1)/4); double L4= (rates[0].close-((rates[0].high-rates[0].low)*1.1)/2); double price=0.0; double sl=0.0; double tp=0.0; price=L4; sl=(InpStopLoss==0.0)?0.0:ExtStopLoss; tp=(InpTakeProfit==0.0)?0.0:ExtTakeProfit; m_trade.BuyLimit(InpLots,m_symbol.NormalizePrice(price),m_symbol.Name(), m_symbol.NormalizePrice(price-sl), m_symbol.NormalizePrice(price+tp)); price=H4; sl=(InpStopLoss==0.0)?0.0:ExtStopLoss; tp=(InpTakeProfit==0.0)?0.0:ExtTakeProfit; m_trade.SellLimit(InpLots,m_symbol.NormalizePrice(price),m_symbol.Name(), m_symbol.NormalizePrice(price+sl), m_symbol.NormalizePrice(price-tp));
Regards, Vladimir.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Surefirething:
Working with pending Buy Limit and Sell Limit orders. Trailing the positions is possible.
Author: Vladimir Karputov