[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 317
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
.
in inserted. problems with the cycle and restoring initial values after exiting the cycle
Here's the function that will answer whether the last trade was profitable or unprofitable:
Then, by comparing its answer to zero, you decide whether to leave TP/SL the same or change them.
Hi all. I am interested in the IN10TION NewsReader indicator. I want to attach it to my EA.
If a red line appears (Market.TdOpen) and Market.Price.DOWN(red) then sell
If a red line appears (Market.TdOpen) and Market.Price.UP(green) then buy
What actions can I take? I have tried iCustom but it does not work!
_yIN10TIONfNewsReaderov09.99kblite.ex4 (115.59 KB) delete
Apologies to the admins for repeating myself, but no one has said half a word to me yet. The idea is to output messages stored in logs, i.e. those which cannot be fixed correctly by IsConnected() function - connection failures, reqests. Otherwise it is not clear why the EA is not doing anything at the moment.
Please suggest the code below to read the log file. Automatically reads the current log file by date and outputs it to the printer.
Where:
A file is being assembled from parts. But I don't need the whole file, just the last line. Help to correct it, please.
Need help changing an EA
The Expert Advisor should trade on the reverse.
Instead of sell limit orders buy
and buy limit orders sell
Here is the function that will answer whether the last trade was profitable or unprofitable:
Then, by comparing its answer to zero, you decide whether to leave TP/SL the same or change them.
Is your function sure to return the last order? Or will it return the first order which was not losing? Why is there a check on the ticket?
I would do it this way:
This is a redesign of your function to find exactly the last closed order.
It has the disadvantage that if there were no orders closed at all, it will return zero. Thus, using it, it is impossible to know for sure if there are or are not any closed orders in the history. After all, the returned zero does not indicate that there is no order at all, but that it is closed at zero.
Please advise:
is interested in rendering of indicator value only for last (current) bar. However, when opening a new bar, the old values remain on the chart.... How can I forcefully remove this rubbish? Is it possible to specify the condition that for the bar [0] the indicator values are calculated and shown, and for the bars from [1] to [Bar-1] these values are reset?
artmedia70:
It has the disadvantage that if no orders have been closed at all, it will return zero. Thus, using it, it is impossible to know for sure if there are or there are no closed orders in the history. After all, the null returned does not mean that there is no order at all, but it shows that it was closed at zero.
Thank you! Although you didn't reply to me, you answered my previous question about the correct calculation of profit:
Please advise:
is interested in rendering of indicator value only for last (current) bar. However, when opening a new bar, the old values remain on the chart.... How can I forcefully remove this rubbish? Is it possible to specify the condition that for the bar [0] the indicator values are calculated and shown, and for the bars from [1] to [Bar-1] these values are reset?
Is your function sure to return the last order? Or the first one encountered is not unprofitable? Why is there a check on the ticket?
I would do it this way:
This is a conversion of your function to find exactly the last closed order.
It has a disadvantage - if there were no closed orders at all, it will return zero. Thus, when using it, we cannot know for sure if there are any closed orders or not in the history. The null returned does not indicate the absence of the order at all, but it does indicate that it was closed at zero.
1. The function finds the order with the largest ticker in the history, which means the last closed order (unless, of course, we take some exceptional case, for which your variant with the maximum time of closing is preferable).
2. According to the conditions , the first order is opened with the specified TP/SL and only the second order may be opened with the new TP/SL, which means that the function can return zero only if the first trade was zero, but not if there are no closed orders in the history.
One last thing. In your variant the use of j and another SELECT in the function is redundant.
it is enough:
At the beginning of Start() initialise the buffer with value EMPTY_VALUE.
How is this? I have this in the indicator line settings after int init()
SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,165); SetIndexBuffer(0,Buffer); SetIndexEmptyValue(0,0.0);