[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 587

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
Example:
Here my selected variables are of type double, but in iMA their value is used where an int value is needed (as a period of MA).
The question is: Is this usage correct or is it necessary to convert the values to int type ?
I don't mind, is there a working example or link?
Please tell me if it is possible to use the value of double, which is the result of the calculation, as a substitute int value for further calculations.
Example:
Here my selected variables are of type double, but in iMA their value is used where int value is needed (as period of MA).
So my question is: Is such usage correct or some conversion of values to int type is necessary ?
The conversion is done automatically, just cutting off the fractional part. The only limitation to this usage I've seen is that double cannot be put in the array index
One more question:
Constructions
do not work. When displaying their values in the chart they all have the same value, e.g:
1.4118 for MA200_DIN, MA200_UP, MA200_DN and
1.4106 for MA5_DIN, MA5_UP, MA5_DN.
It turns out that formulas for calculation of levels +20 and -20 points do not work.
What am I doing wrong?
As Matroskin said: You're a fool... :)
Give us a code or set a task and we will correct it
In WelsLab, the analog of the problem looks like this:
MyATR = SMA.Series((((High-Low)/Low), PerB)[i-1] ;
if (BuyAtStop(i, (Open[i] + Open[i]*MyATR), "") ;
i.e. when a bar is opened, a Stop position is placed where Open [i] price of the current bar + trigger (the same Open price multiplied by MyATR calculated for the period PerB on the closed bars [i-1]) is opened once if the specified level is reached
This one shows what I want to get on mql4 using WellLab as an example.
I have studied the site materials and tried to make an analogue.
Result: Orders are piling up. Please advise what condition should be added (or changed) to make the orders be executed at a specified level once.
Note: the first parameter of the iMAOnArray function should be an array - and you have MyATR scalar. In order to get it right, you should:
1. declare double MyATR[];
2. set the array size to ArrayResize(MyATR,PerB);
3. fill the array for(i=1;i<=PerB;i++) MyATR[i-1]=(High[i]-Low[i])/Low[i]; index i starts with 1 since we need only closed bars
4. after this you can read iMAOnArray(MyATR,0,PerB,0,MODE_SMA,0); here the last parameter is 0 since shift ha1 has already been taken into account in step 3.
Check how it works, maybe the error is just in this