[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 271
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
I understand what's there. But it's not clear why it's implemented this way.
Each individual library function is part of the whole, and an individual library is part of the whole complex of my libraries - without this awareness it is impossible to understand the code.
You can't use your libraries in their original form anyway, i.e. you have everything tied up there. Every function on the pack of others...
And that's where you're wrong. Have you ever thought about the structure of "average" EA? What makes an EA individual is the strategy conditions (i.e., entry/exit conditions), and everything else is standard code. The way I create EAs, including those based on orders: I take a template (for example, SAR, if a network EA is needed) and connect to it an additional library in which the conditions of a new strategy are written (I re-create it).
I did not want to check it by any means. Even more, there is no doubt that everything is written very competently. I just do not quite understand everything, so I said that I do not think so. I look, I think... But I don't understand everything. That's why I asked.
P.S. With bs_Symbol I still don't get it.
Friends! I need help in fine-tuning an EA.
We have code that opens an order under certain if condition. The execution of the condition can take place every tick because it is placed in the body of int start().
We need:
1. After the execution of the condition (and the opening of an order), pause for the opening of new orders, pause for n bars. For example, if the EA is on timeframe M30 and I need to pause for 3 hours, the pause should be 6 bars.
2. This program should work in the strategy tester.
What code is needed? And what would be the right place to put it.
The function iBarShift() will help you. First, you need to find out the time of the last order opening and pass it to this function, and then monitor the value returned by this function by comparing it to some number (in your case, 6).
Let's sort it out together )
We pass the time of the last order opening to this function and obtain the number returned. This is approximately:
Ok we got the bar number. Now how do we pause to open orders for 6 bars?
Let's sort it out together )
We pass the time of the last order opening to the function, and get the number returned is approximately:
Ok we got the bar number. Now how do we pause to open orders for 6 bars?
This is an illiterate approach:
But since it's not directly relevant to this case, we just don't focus on it. The scheme looks like this:
There are no obvious errors in the logic. Print the code step by step. The trade procedure is tied to the value of the ticket variable. First of all, monitor its changes. Also pay attention to the value of global variable "TRADECONTEXT" - its value must be 0.
Thank you! I just don't understand anything(((, I'm like a blind kitten in these codes(((...
Thank you! But I don't understand a thing(((, I'm like a blind kitten in these codes(((...
Each individual library function is part of the whole, and each individual library is part of the whole complex of my libraries - without this awareness it is impossible to understand the code.
I'm trying to understand it, and I'm bumping into all sorts of nuances. That's why I'm asking you, because you know best. You are the author...
And that's where you're wrong. Have you ever thought about the structure of the "average" Expert Advisor? What makes an EA individual is its strategy conditions (i.e., entry/exit conditions), and everything else is standard code. The way I create Expert Advisors, including those based on orders: I take a template (for example, SAR, if a network EA is needed) and connect to it an additional library in which the new strategy conditions are written (I re-create it).
I understand that. I just do not want to copy the entire library. You understand that it is more convenient to create a foundation, with which it will be convenient to work personally.
To understand the implementation, you need to understand the initial data. The libraries were created with the possibility to work with any tool (Forex) and in both mono and multicurrency mode, hence, the global variable bs_Symbol was introduced, which contains the value of the current symbol.
And where this variable is set explicitly, if it's not a secret? :) I see in the libraryb-PSI@Base.mqh that it is only declared:
bs_Symbol, // текущий инструмент
But there is nothing further in fact. Anyway, the value of the current tool is returned by default through Symbol(). So why do we need a variable here?
This is an illiterate approach:
But, as it's not directly relevant to this case, we just don't focus on it. And the pattern looks like this:
:) But if it is introduced into the Expert Advisor as it is now, everything starts to work incorrectly.
As far as I understand, it is due to this entry:
What's wrong?
Our code now works. In my version, it works like this:
:) Except that if it is implemented in the EA as it is now, then everything starts to work incorrectly.
I understand because of this entry:
What's wrong?
I have only sketched a scheme, while your task was to think over the further logic: