expert advisor

 

Hello I startinf to learm MQL4 and I have problem 

input int SmallSMA=9;

 input int BigSMA=17;

void OnTick()

{

string signal "";

double SmallMovingAverage1 = iMA(_Symbol, _Period, SmallSMA, 0, MODE_SMA, PRICE_CLOSE, 1); 

double BigMovingAverage1 = iMA(_Symbol, _Period, BigSMA, 0, MODE_SMA, PRICE_CLOSE, 1); 

double SmallMovingAverage2 = iMA(_Symbol, _Period, SmallSMA, 0, MODE_SMA, PRICE_CLOSE, 2); 

double BigMovingAverage2 = iMA(_Symbol, _Period, BigSMA, 0, MODE_SMA, PRICE_CLOSE, 2); 

if (BigMovingAverage1 > SmallMovingAverage1)

if (BigMovingAverage2 < SmallMovingAverage2)

}

{

signal="sell";

}

{

if (BigMovingAverage1 < SmallMovingAverage1)

if (BigMovingAverage2 > SmallMovingAverage2)

}

{

signal="buy";

}

{

 if (signal=="buy" && OrdersTotal ()==0)

 OrderSend (_Symbol,OP_BUY, 0.10,Ask,3,0, Ask+150* Point, NULL, 0,0, Green);

 if (signal=="sell" && OrdersTotal () ==0) 

 OrderSend (_Symbol,OP_SELL, 0.10,Ask,3,0, Ask+150* Point, NULL, 0,0, Green);

 Comment ("The current signal is:",signal);

 }

can sombodey tell me what the mistake her ?

 
ניר לוי:

Hello I startinf to learm MQL4 and I have problem 


can sombodey tell me what the mistake her ?


Yes,

first use Code (Alt+S) icon to insert you code.

After,  I see brackets ( { and } ) not well inserted...

 
ניר לוי:

Hello I startinf to learm MQL4 and I have problem 

can sombodey tell me what the mistake her ?

When you post code use;

post-code


1st you could check your SELL order send function;

 OrderSend (_Symbol,OP_SELL, 0.10,Ask,3,0, Ask+150* Point, NULL, 0,0, Green);

//which is wrong as you SELL at Bid and i suggest you use magic number

OrderSend (_Symbol,OP_SELL, 0.10,Bid,3,0, Bid+150* Point, NULL, 12345,0, Red);
 

You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.

  1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

  2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
              MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25

  3. The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
    Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).

 

can anyone make EA based on my strategy

<Deleted>

MY STRATEGY :  1.  FIRST  FIND ABCD PATTERN ON ANY TIME FRAME ON ANY PAIRS (SCAN ALLL PAIRS)

2. THEN ON B TO C WAVE MAKE A RED FIBO EXTENTION

3 THEN ON C TO NEXT WAVE D MAKE A BLUE FIBO EXTENTION WHICH HAS NOT STILL ENDED TO D LINE'

4. NOW ON C TO  D WAVE LINE SEARCH FOR THE TWO CANDLES WHICH HAS THE SAME RANGE FROM HIGH TO LOW WITH ONE OR TWO CANDLES SIDE BY SIDE BE IT ANY CANDLE OF PIN BAR OR EQUAL '

5. FOLLOW THE NEXT CANDLE WITH RISING OR FALLING AND WAIT FOR IT TO CLOSE 

6. IF THE CANDLE IS RED THEN GO FOR ENTRY ON SELL AND IF IT IS BLUE GO FOR IT TO BUY

7 THE FIBO LEVEL TO TOUCH IS EITHER 50.0 LEVEL OF THE WAVE MEASURED B TO C  OR THE THREE CANDLES CLOSING STARTING NEXT TO THE EQUAL RANGING TWO CANDLES 

KINDLY CONTACT IF ANY ONE CAN BE SURE TO MAKE IT AND ALSO WILL TELL U MORE ABOUT IT

 
Raj Gupta:

can anyone make EA based on my strategy

Please do not make excessive use of capital letters when posting.It is considered shouting and very rude.

Reason: