[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 221
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 my experience, the most effective way to find errors is to display a message in the comments with the error number followed by a visual run of the EA. In the beginning it takes a lot of time, but then you quickly learn how to do it without errors. You can also exclude parts of the code with /* ... */, you can determine how the behaviour of the EA changes.
You got it right. Further, when we take a value out of the box, it is of type double, but if the command is given to write the result into a variable of type int, the compiler will automatically take all necessary steps to put the value into a new box.
To finally make sure I have got it right, please check my thoughts on your last paragraph... So let us have the above mentioned expert:
Then in the string:
We put a variable of integer type Experts in the box "GV-variable" for storage (converting it to type double). Then if (hypothetical assumption) there would be a string in the Expert Advisor
int New_Experts=Experts;
it would mean that there is a command to write the result into a variable of int type. In this case the compiler:
* would take the value of the variable of type double out of the box,
* make any necessary changes to the value of the Experts variable,
* assign this value to the variable New_Experts and...
* put the value of variable New_Experts into an "int" box.
So the variable type is nothing more than just an external wrapper/package of some value? and so GV variables can't be of the string type, as downgrading is only allowed for numeric values, and strings are not converted to numbers.
Right?
Thank you in advance for your reply.
what not so for (f=1;f<Bars;f++)
{
Price1 = (iClose(Symbol_1,0,0) - iClose(Symbol_1,0,f)) / MarketInfo(Symbol_1, MODE_POINT)
Price2 = K*(iClose(Symbol_2,0,0) - iClose(Symbol_2,0,f)) / MarketInfo(Symbol_2, MODE_POINT);
Spread = Price1 - Price2;
Print ("Price1="+Price1, " Price2="+Price2);
if (Spread==0){t=f; break;}
}
Price12 = (iClose(Symbol_1,0,0) - iClose(Symbol_1,0,t)) / MarketInfo(Symbol_1, MODE_POINT);
Price22 = K*(iClose(Symbol_2,0,0) - iClose(Symbol_2,0,t)) / MarketInfo(Symbol_2, MODE_POINT);
Spread2 = Price12 - Price22;
if (MathAbs(Spread2) >= razdvizka && Spread2 < 0) { open trade }
want to fix the bar where the spread was equal to zero and control the spread from it
if(MathAbs(Spread)<eps) { ........ } and you still need to control the result - whether the point satisfying the condition is found or not. IMHO it's better to create a separate function, for example, like this:
hello.
Do you know if there is a #property in indicators that allows the indicator to always show the same period, e.g. d1?
and it will not switch even if you switch timeframes in MetaTrader?
thanks
------------------------------------------
oh... how many pros.....
help!!!!
how to call the indicator from the script, I really need it to be displayed in a window
Good evening! Please help me make changes to the EA code:
1. When testing everything is fine - but when trading the first trade has to be opened manually, stop and take too. I would like the EA to start trading automatically when the price arrives at a new tick.
2. Since in the case of a triggered stop loss, the next position is opened with twice the previous lot, the lot can theoretically increase to infinity (in my case, up to 51.2), I would like to limit it (eg 0.8) with the ability to change the threshold. When the threshold is reached and a stop is triggered, the Expert Advisor would not disconnect and would start over from 0.1.
Help, please. I've been struggling all day without any help.
Order is on the pickup (Main BAY, pending sellsstop as a safety net).
At closing sellsstop in the no-loss, postponed again in the same place.
To finally make sure I have got it right, please check my thoughts on your last paragraph... So let us have the above mentioned expert:
Then in the string:
We put a variable of integer type Experts in the box "GV-variable" for storage (converting it to type double). Then if (hypothetical assumption) there would be a string in the Expert Advisor
it would mean that there is a command to write the result into a variable of int type. In this case the compiler:
* would take the value of the variable of type double out of the box,
* make any necessary changes to the value of the Experts variable,
* assign this value to the variable New_Experts and...
* put the value of variable New_Experts into an "int" box.
So the variable type is nothing more than just an external wrapper/package of some value? and so GV variables can't be of the string type, as downgrading is only allowed for numeric values, and strings are not converted to numbers.
Right?
Thanks in advance for the answer.
Not exactly. The point is that the Experts variable already has the int type, hence, the type conversion must take place BEFORE assigning a value to it, i.e. the compiler
* took out of the box a value of type double (it has no name in your program, and is written simply to some address known to the compiler in main memory or in CPU register)
* made all necessary changes to the value of the above variable and wrote a new value (of int type!) into Experts variable,
* assigned this value (of int! type) to the variable New_Experts. They have the same type, so it's just a matter of copying a value from one memory location to another.
P.S. It's great to see that there are people who comprehend their deeds in such detail. In fact, no kidding. Keep in touch.
Good evening! Please help me make changes to the EA code:
1. When testing everything is fine - but when trading the first trade has to be opened manually, stop and take too. I would like the EA to start trading automatically when the price reaches a new tick.
Since in the case of a triggered stop loss, the next position is opened with twice the previous lot, the lot can theoretically increase to infinity (in my case, up to 51.2), I would like to limit it (eg 0.8) with the ability to change the threshold. When the threshold is reached and a stop is triggered, the EA would not disconnect, but would start over from 0.1.
Try it: