Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 198
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
Here is a piece of code, the data from which is then used for analysis:
i.e. further the code will look like this:
And here is the question: how and where should we put it? If inside the condition, no alerts will be printed, and if outside the condition, the alerts will be printed on every tick.
I apologize for my incorrectly phrased question.
Here is a piece of code, the data from which is then used for analysis:
i.e. further the code will look like this:
And here's the question: how and where should we put it? If inside the condition, no alerts will be printed, and if outside the condition, the alerts will be printed on every tick.
I apologize for my incorrectly phrased question.
Thank you, I have sorted it out. Here is another question: the alerts are now generated from a specified time interval and when the range is exceeded up to the "stop". Can I somehow stop this "search" when the first value satisfies the condition?
Well, you need to understand the main condition that is true all the time, over a period of time. For example - comparing times. After issuing all the alerts, you need to assign a new value to the variable with which you are comparing the current time. Look for a function that defines a new bar. The concept of its construction should help you.
Have you read it here?
How do I know the minimum distance from the market to place a pending order?
How do I know the minimum distance from the market to place a pending order?
int level=MarketInfo(Symbol(), MODE_STOPLEVEL);
if the StopLevel is zero, then most likely level=MarketInfo(Symbol(), MODE_SPREAD)*2;
Alpari precisely uses double spread as StopLevel.
To determine the distance read here.
Thank you artmedia70:
OK, long time no answer, I'll give you a hint: when returning true value from isCloseLastPosByStop () function, return one more value, which is the lot size of the last position found.
How to do? Pass a variable into the function by reference, in which you will write the lot size in the function itself. To do this, you will need to slightly modify function isCloseLastPosByStop ()
If you don't understand anything, look for a function that returns the lot size of the last closed position. Or you can make one yourself. And use it, but this is more costly than passing the lot value together with true
I have changed the function so that instead of True function returns a variable lot, in which the function itself I have written the size of the lot.
Everything compiles, but the orders don't open:
2013.10.23 20:57:46 2011.02.24 16:25 GMT EURUSD,M5: OrderSend error 4051
2013.10.23 20:57:46 2011.09.22 22:20 WEDNING EURUSD,M5: invalid lots amount for OrderSend function
Please tell me what my mistake is.
Thank you.
I have changed the function so that instead of True the function returns a variable lot, in which I have written the lot size in the function itself.
All compiles, but the orders are not opened in the journal says:
2013.10.23 20:57:46 2011.02.24 16:25 PM EURUSD,M5: OrderSend error 4051
2013.10.23 20:57:46 2011.09.22 22:20 WEDNING EURUSD,M5: invalid lots amount for OrderSend function
Please advise what is my mistake.
Thank you.
The function determining the last closed position by stop has a bool type, while you are trying to return the double type. Correspondingly, it returns either 0 or 1.
I wrote that we should add passing of one variable by reference into it:
Now check the last Buy, for example:
Like this...
Good evening.
Could you please tell me how to add closing all positions and deleting all orders at the end of the trading week?
Thank you!