Use command alt+s when posting your code!
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
Can please someone help me o make this work?
void OnTick()
{
// create an Array for several prices
double myMovingAverageArray1[],myMovingAverageArray2[];
// define the properties of the Moving Average1
int movingAverageDefinition1 = iMA (_Symbol, _Period, 20, 0, MODE_EMA, PRICE_CLOSE);
// define the properties of the Moving Average2
int movingAverageDefinition2 = iMA (_Symbol, _Period, 50, 0, MODE_EMA, PRICE_CLOSE);
// sort the price array1 from the current candle downwards
ArraySetAsSeries (myMovingAverageArray1, true );
// sort the price array1 from the current candle downwards
ArraySetAsSeries (myMovingAverageArray2, true );
// Defined MA1, one line, current candle, 3 candles, store result
CopyBuffer (movingAverageDefinition1,0,0,3, myMovingAverageArray1);
// Defined MA2, one line, current candle, 3 candles, store result
CopyBuffer (movingAverageDefinition2,0,0,3, myMovingAverageArray2);
if ( // Check if the 20 candle EA is above the 50 candle EA
( myMovingAverageArray1[0]>myMovingAverageArray2[0])
&& ( myMovingAverageArray2[1]>myMovingAverageArray1[1])
)
trade. "Buy(0.10, NULL,Ask,Ask -300* _Point,Ask+150*_Point, NULL ;"