[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 175
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
Good afternoon, could you please tell me if there is a code
which will select the last order in the history with a negative profit.
If there is a situation when 3 orders are closed at the same time, how do I know that the last 3 orders have closed at the same time?
i tried to do the for loop, but it finds all orders closed at a loss, while i need only the last order or the last order depending on how many of them closed at once
I did not find an answer in the search
how can i see from the script which indicators are on the chart, what parameters and indicators, in which subwindows they are located?
thanks
No way.
vik-777:
how do I know that the last 3 closed at the same time?
Good afternoon, could you please tell me if there is a code
which will select the last order in the history with a negative profit.
If there is a situation when 3 orders are closed at the same time, how do I know that the last 3 orders have closed at the same time?
i tried to do the for loop, but it finds all orders closed at a loss, while i need only the last order or the last order depending on how many of them closed at once
If it is the same, then you compare it with the time of closing of your previous closed order... like this, naturally, it's all in a loop - from the last closed to the first, you go one after another and compare the time of orders closure... Another thing - print the closing time of the last orders you know beforehand, let's say three orders , it may be different, even if you understand it as " simultaneously", i.e. as I understand it, the order closes at any time, i.e. Actually, the time of closing of, say, three orders at once cannot be the same - try to print () and see the values of your three TIME orders - their values of OrderCloseTime() characteristics, i.e., we may have to introduce the concept of TIME of closing, i.e., deviation of closing time of several orders by some small value when we may consider that they have closed simultaneously. Experiment and see for yourselves from here.
Taking help from the hall.
How to write a condition in OrderSelect():
if(order opening day != today's day)ticket=OrderTicket();
HOW WOULD YOU COUNT THE NUMBER OF PROFITABLE LONG POSITIONS AND THE NUMBER OF PROFITABLE SHORT POSITIONS SEPARATELY?
The strategy is as follows: if the number of profitable long positions since the start of the Expert Advisor (or better - for the entire account history) is greater than the number of short positions, then only long positions should be allowed to be opened. And vice versa.
It is clear how to count these deals, if they are closed by the Expert Advisor: Close - Count. But if a position is closed by TP or SL, then ... ?
Maybe someone has a ready code of the function?
Well, compare in a loop over closed positions their close price and their take and stop prices:
OrderTakeProfit(); OrderStopLoss(); OrderClosePrice();
And it is even easier to select OP_BUY and OP_SELL and write in four separate variables the number of losing and profitable Buy and Sell positions
if (OrderProfit()+OrderSwap()+OrderCommission()>0) { /* position is profitable */ }
else { /* position is losing */ }
I've looked at everything..., I've done everything... It won't open a position, that's all! It closes properly, but it doesn't open... I don't know what to do! Maybe someone will find a bug in the program?