Aris pamuji
New Member
- Credits
- 0
//+------------------------------------------------------------------+
//| asyaf2.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//--- input parameters
input int FastMA= 8;
input int SlowMA= 55;
input double Lots= 0.02;
input ENUM_MA_METHOD MA_methode = 0;
input ENUM_APPLIED_PRICE MA_Price = 0;
//fungition nilai MA fast
double pMA_f (int shift){
double result = 0;
result = iMA(Symbol(),0,FastMA,0,MA_methode,MA_Price,shift);
return(result);}
// nilai MA slow
double pMA_s (int shift){
double result = 0;
result = iMA(Symbol(),0,SlowMA,0,MA_methode,MA_Price,shift);
return(result);}
//fungsi open order
void AsfOrder(int cmd){
int Tiket = OrderSend(Symbol(),cmd,Lots,0,0,0,0,"asyaf order");
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Alert ("Selamat Datang Di EA by Asyaf57");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// order buy
if (pMA_f (1) < pMA_s(1) && pMA_f (0) == pMA_s (0))AsfOrder(OP_BUY);
if (pMA_f (1) >= pMA_s(1))return;
if (pMA_f (1) > pMA_s(1) && pMA_f (0) == pMA_s (0))AsfOrder(ORDER_TP);
}
//+------------------------------------------------------------------+
//| asyaf2.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//--- input parameters
input int FastMA= 8;
input int SlowMA= 55;
input double Lots= 0.02;
input ENUM_MA_METHOD MA_methode = 0;
input ENUM_APPLIED_PRICE MA_Price = 0;
//fungition nilai MA fast
double pMA_f (int shift){
double result = 0;
result = iMA(Symbol(),0,FastMA,0,MA_methode,MA_Price,shift);
return(result);}
// nilai MA slow
double pMA_s (int shift){
double result = 0;
result = iMA(Symbol(),0,SlowMA,0,MA_methode,MA_Price,shift);
return(result);}
//fungsi open order
void AsfOrder(int cmd){
int Tiket = OrderSend(Symbol(),cmd,Lots,0,0,0,0,"asyaf order");
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
Alert ("Selamat Datang Di EA by Asyaf57");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// order buy
if (pMA_f (1) < pMA_s(1) && pMA_f (0) == pMA_s (0))AsfOrder(OP_BUY);
if (pMA_f (1) >= pMA_s(1))return;
if (pMA_f (1) > pMA_s(1) && pMA_f (0) == pMA_s (0))AsfOrder(ORDER_TP);
}
//+------------------------------------------------------------------+