[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 570
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
Please tell me what's wrong, I'm new to mql.
I put TimeBar_t = Minute(); I can't decide if I am missing brackets or ;
Note: when testing, the last known server time is simulated.
So your condition will only hold at start time.
rigonich,
to be precise (OrderProfit()+OrderCommission()+OrderSwap()
So, how do I take information from closed orders?
I select orders using OrderSelect() and MODE_HISTORY from the closed ones, but how can I select the necessary ones?
If I can take from the history those that closed after my condition, then of course I will take and summarise what I need. But I don't understand how to do that, unfortunately.
What do you need? For example, remember the opening date of the first order on the instrument by your EA and select all those opened after it, reset the value of the variable after closing by conditionand remember the new (current) value.
Please advise.
In my EA, the exit calculation is based on accumulated profit. For example, if at some point in time equity=balance, then the EA will close all trades when the current equity exceeds this very initial one. It will close all trades no matter how many of them there are.
It is simple in the tester, as there is one currency pair.
However, trading is realistically effected with several currencies and each one has to be considered separately. For example: If there are no open trades on some currency pair, then the variable==0. And we should trace closed trades at this symbol as well and wait until the accumulated profit exceeds the loss from open orders of this symbol by the specified value.
I cannot find in the tutorial a function that may be used to separate the accounting of accumulated profits for different currencies. Please advise. Thank you.
https://www.mql5.com/ru/forum/131859/page3#434223 here, and alsohttps://www.mql5.com/ru/forum/131859/page3#434222
I can't write an additional condition to open a position according to my idea.
If I close any position with TP or SL it should reopen with the opposite position.
Example: If a Sell position, say SL, is closed, it will reopen a Sell position together with it and Buy
Here are 2 conditions from the Expert Advisor:
condition to buy
if (BUY)
{
if (takeprofit!=0) TP = NormalizeDouble(Ask + takeprofit*Point,Digits); else TP=0;
if (stoploss!=0) SL = NormalizeDouble(Ask - stoploss*Point,Digits); else SL=0;
if(NumberOfPositions(Symbol(),OP_BUY,Magic)<MaxOrders)OPENORDER ("Buy");
}
sell condition
if (SELL)
{
if (takeprofit!=0) TP = NormalizeDouble(Bid - takeprofit*Point,Digits); else TP=0;
if (stoploss!=0) SL = NormalizeDouble(Bid + stoploss*Point,Digits); else SL=0;
if(NumberOfPositions(Symbol(),OP_SELL,Magic)<MaxOrders)OPENORDER ("Sell");
}
Who understands this, please help me to write additional condition
To shift to the left -- F12, to the right -- I don't know.
RigonichThanks, that's a great tip! Just what I need!
I have not done anything with it, it still does not work ((((
It worked only if the price goes in one direction then it opens and if the price turns around it does not open((
Help me write a condition to open a position.
I can't write an additional condition to open a position according to my idea.
If I close any position with TP or SL, I want it to open a new position with the opposite value.
Example: if a Sell position was closed by SL, it will reopen a Sell position together with it and Buy.
Here are 2 conditions from the EA:
Buy condition
if (BUY)
{
if (takeprofit!=0) TP = NormalizeDouble(Ask + takeprofit*Point,Digits); else TP=0;
if (stoploss!=0) SL = NormalizeDouble(Ask - stoploss*Point,Digits); else SL=0;
if(NumberOfPositions(Symbol(),OP_BUY,Magic)<MaxOrders)
}
Sell condition
if (SELL)
{
if (takeprofit!=0) TP = NormalizeDouble(Bid - takeprofit*Point,Digits); else TP=0;
if (stoploss!=0) SL = NormalizeDouble(Bid + stoploss*Point,Digits); else SL=0;
if(NumberOfPositions(Symbol(),OP_SELL,Magic)<MaxOrders)
}
Who understands this, please help me to write additional conditions
I'm sorry, but in the attached files you have a compiled file, not the source file. You can't view it. Please send the file with the .mq4 extension