I am new to mql4 trying to write an Expert Advisor using the aligator indicator
I'm trying to write an EA on mql4 but nothing useful has come out yet.
Citizens Professionals may have asked you such trivial requests, questions , etc., but still could ask the professionals to write an expert on the aligator indicator
But still can ask you professionals to write an expert on the aligator indicator
Pips strategy
Buy and Sell positions are closed when StopLoss and TakeProfit are achieved
A buy signal when the green line crosses the blue and red from below upwards opens a Buy position
a Sell signal when green ruler crosses red and blue from upside down to open a Sell position
do not open more than one order until the crossover is closed
artmedia70: Your arrays are int, but Open and Close are double
Replaced, still zeros. And another thing - in my two-dimensional arrays, one set is of double type, while the second one is of int type (bar indexes). How to bring them to one type while calculations, but to return to the former type again when the result is output?
-xlapex-: Replaced, still zeros. One more thing - in my two-dimensional arrays, one set is of double type, and the second one is of int type (bar indexes). How to convert them to the same type for the time of calculations, but to return to the same type again when the result is output?
I've been thinking, and decided that two arrays are redundant, they are already programmatically specified. Now it will be easier to think. How can I reduce them to one type?
int start() { double mas1[30,2],mod_1; int ind_1; { for (int i=1;i<=30;i++) { mas1[i, 0] = MathAbs(Close[i]-Open[i]); mas1[i, 1] = i;
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Here I have applied the MathAbs function, Alert shows zero and zero, but I would like a modulus of difference and a bar index...
{
int mas1[30,2],mas2[30,2],mas3[30,2],ind_1;
{
for (int i=1;i<=count_bars;i++)
{
mas1[i, 0]=Close[i];
mas1[i, 1]=i;
mas2[i, 0]=Open[ i];
mas2[i, 1]=i;
mas3[i, 0] = MathAbs(Close[ i]-Open[ i]);
mas3[i, 0] = i;
ArraySort( mas3);
mod_1=mas3[2, 0];
ind_1=mas3[2, 1];
Alert( mod_1," ",ind_1);
}
}
return(0);
}
Hi All
I am new to mql4 trying to write an Expert Advisor using the aligator indicator
I'm trying to write an EA on mql4 but nothing useful has come out yet.
Citizens Professionals may have asked you such trivial requests, questions , etc., but still could ask the professionals to write an expert on the aligator indicator
But still can ask you professionals to write an expert on the aligator indicator
Pips strategy
Buy and Sell positions are closed when StopLoss and TakeProfit are achieved
A buy signal when the green line crosses the blue and red from below upwards opens a Buy position
a Sell signal when green ruler crosses red and blue from upside down to open a Sell position
do not open more than one order until the crossover is closed
StopLoss =10;
TakeProfit =10;
Magic =33;
SlipPage =5;
Lot =0.1;
Thank you in advance
Your arrays are int, but Open and Close are double
Replaced, still zeros. One more thing - in my two-dimensional arrays, one set is of double type, and the second one is of int type (bar indexes). How to convert them to the same type for the time of calculations, but to return to the same type again when the result is output?
And what does count_bars equal?
And what does count_bars equal?
count_bars = 30;
I've been thinking, and decided that two arrays are redundant, they are already programmatically specified. Now it will be easier to think. How can I reduce them to one type?
{
double mas1[30,2],mod_1;
int ind_1;
{
for (int i=1;i<=30;i++)
{
mas1[i, 0] = MathAbs(Close[i]-Open[i]);
mas1[i, 1] = i;
ArraySort(mas1);
mod_1=mas1[2, 0];
ind_1=mas1[2, 1];
Alert(mod_1," ",ind_1);
}
}
return(0);
}
count_bars = 30;
Then replace with
to
Then replace with
to
I replaced it. mod_1 gives set={1,3,5,7,9,...,29}, but ind_1 keeps showing zero.
does not show zero
but your code is a bit incomprehensible
for example, the mas array hasn't been formed yet, but you are already sorting it
Maybe the context of your question makes it better:
Replaced. mod_1 gives set={1,3,5,7,9,...,29}, but ind_1 keeps showing zero.
Yeah.... And why am I so absent-minded?!
It turns out that everything is simple - ArraySort(mas1,30,1,MODE_DESCEND ). All you have to do is write everything you're supposed to.
does not show zero
but your code is a bit incomprehensible
for example, the mas array hasn't been generated yet and you're already sorting it