Making Robot in Meta
Every Trader knows what EA is, and ussualy EA is Expert Advisor, in EA, there are 7 functions will be explained below  
1.    BuySignal : With the what kind of condition, EA will be open for Buying position
2.    SellSignal : Analogue with number 1, the different is will be open for Selling position
3.    CloseBuySignal : With the condition what for closing for Buying Position, and this part is not necessary and not really important, because we can use TP and SL for closing
4.    CloseSellSignal : Analogue with number 3, the different is for Closing Selling Position
5.    MoneyManagement : For counting Lot or Pips Automatically buat itung lotsize secara otomatis
6.    Trail : For Trailling Position buat trailling posisi
7.    Confirmator : For example in EA we want to trade for 4 days, so it’s  really important to put it
If we can find the 7 parts, for making EA is easilier , for the trader who likes making a EA everyday when they want to trade, ussualy they call it this EA like a Robot EA.
For making a Simple EA or a Robot EA, it depends on the problem we have, I mean the problem if we want to take the best for our trading, and what the currencies we have.
From me, I like trading Euro-USD and analizing that currencies, because it’s more challenge for me, and I like using 1 Hours for Time in the Chart, where I have no to be rush for making decision, and I like to make it EMA is 10 points, for buying and selling, with the TP is 150 and SL I make it in 50, all I use when I have to go outside and don’t have to  stay 24 Hours in front of my Computer.
So for the day, I prefer in the second days, mostly I trade, I don’t like for trading in the first day, same like I’ve just waken up, of course I need some water or Coffee, and I would not doing working out or Running, and you can know what I mean, why I don’t like Trading in the first day. And So
For me, With assuming I start trading in the second day, and assuming more I like doing trading only two days, it means that I will be trading as long as 2 days, and ussualy i choose the best for Slippage is always 4.
Why I choose 4? Believe or not, the best slippage depends is the how long for trading a week, for me, because I always trade only 4 days, so I make the slippage is 4   
So, after reading from my  trading, I will give a little explaination, the simple EA from me, where I use trading in Euro-USD (and we can change if we have an idea or different, or we want to combine, for example my day for trading is 4 days, if there’s a trader always trading in 5 days, it means that the code as you can be seen in below with using 12345)
So here the little program from me
Extern string tx Comment=”Operation of EA″;
Extern int Magic Of Number=234; (The day for Trading, for example the second day till fourth day)

Extern int Slippage=4; (your Slippage, and it depends on your trading)

After that you write, give the sign like bellow  

//+——————————————————————+

//| expert initialization function |

//+——————————————————————+

int initialization()

{

//—-

//—-

return(4);


}

//+——————————————————————+

//| expert deinitialization function |

//+——————————————————————+

int deinitialization()

{

//—-

//—-

return(5);

}

//+——————————————————————+

//| expert start function |

//+——————————————————————+

int start()

{

//—-
          
if (May Trade()) // (use the own world like can be I traded today)

{

if (BuySignal() ) //(You see the buy position, so then you want to take the
buy signal )

{

OrderForSending(Symbol(),OP_BUY,Ask,Ask+StopLoss:Point,Ask-TakeProfit:Point,txComment,MagicNumber);

}

else if (SellSignal() ) // You see the buy position, so then you want to take

the sell signal

{


OrderSend(Symbol(),OP_SELL,itungLot(),Bid,Slippage,Bid+StopLoss*Poin

t,Bid-TakeProfit*Point,txComment,MagicNumber);

}

}

//—-

return(0);

}

After that repeat again for the buy signal and before it, give the sign for buy signal like this
//+——————————————————————+
 BuySignal()
{
In this page you see with all eyes, and that why the robot will make you loss again and again, and some programmer usually use the math like this for buy signal :
// Assume that it will be more than 10 for the EMA, with the assume see the before candlesticks 
if (iClose(Symbol(),0,1) >
iMA(Symbol(),0,10,0,MODE_EMA,PRICE_CLOSE,1) )
{
return(true);
}
Else
{
return(false);
}
}
Same with the  SellSignal()
{
// Assume that it will be more than 10 for the EMA, with the assume see the before candlesticks 
In this page you see with all eyes, and that why the robot will make you loss again and again, and some programmer usually use the math like this for sell signal :
if (iClose(Symbol(),0,1) <
iMA(Symbol(),0,10,0,MODE_EMA,PRICE_CLOSE,1) )
{
return(true);
}
Else
{
return(false);
}
}

Same with the Can be trader ()
{
//If can be trading
In this page you see with all eyes, and that why the robot will make you loss again and again, and some programmer usually use the math like this for the signal (with assuming that in Friday, so it means Days of week equals 4), so the programmer make like this:
if (DaysOfWeek()==4 || OrdersTotal()>0) { return (false); } else { return(true);
}
}
Now for Counting Lot (pips)()
{
//the programmer without the reason use the any point like this formula xLots=0;
xLots=NormalizeDouble(AccountBalance()*RiskPercent/100 /StopLoss /
10,1);
return (xLots);
}

Based on my Old Blog : democontesttrading.blogspot.com
Translate to English Show original