//+-------------------------------------------------------------------------------------------------------------------+
//| Putra Kuningan 2_0.mq4 |
//| Copyright 2021, Putra Kuningan Group. |
//| https://www.putrakuningangroup.com |
//+-------------------------------------------------------------------------------------------------------------------+
#property copyright "Copyright 2021, Putra Kuningan Group."
#property link "https://www.putrakuningangroup.com"
#property version "1.00"
#property strict
input double Lots = 0.01;
input int StopLoss = 300;
input int Magic = 16011989;
//+-------------------------------------------------------------------------------------------------------------------+
//| Expert initialization function |
//+-------------------------------------------------------------------------------------------------------------------+
int OnInit(){
return(INIT_SUCCEEDED);
}
//+-------------------------------------------------------------------------------------------------------------------+
//| Expert deinitialization function |
//+-------------------------------------------------------------------------------------------------------------------+
void OnDeinit(const int reason){
}
//+-------------------------------------------------------------------------------------------------------------------+
//| Expert tick function |
//+-------------------------------------------------------------------------------------------------------------------+
void OnTick(){
}
//+-------------------------------------------------------------------------------------------------------------------+
//=========================================== Area Comment ============================================================
void QnComment (){
//Informasi Account melalui comment
Comment(
" Informasi Account:",
"\n Name : ", AccountName(),
"\n Account Number : ", AccountNumber(),
"\n Acoount Balance : ", AccountBalance(),
"\n Acoount Equity : ", AccountEquity(),
"\n Account Server : ", AccountServer(),
"\n Volume : ", Volume[0],
"\n Total Signal :"
);
}
//=============================================== MEMBUAT ORDER =========================================================
//Menghitung Take Profit
double TheTP(int shift=1){
double result=0;
double HargaChandel = Close[1]-Open[1];
double HargaChandel1= Open[1]-Close[1];
if(Open[shift] < Close [shift]){
if(HargaChandel <= 0.25){
double TP = MathCeil (HargaChandel*250);
result=TP;
}else if(HargaChandel <= 0.50){
double TP = MathCeil (HargaChandel*230);
result=TP;
}else if(HargaChandel <= 1){
double TP = MathCeil (HargaChandel*140);
result=TP;
}else if(HargaChandel <= 1.15){
double TP = MathCeil (HargaChandel*70);
result=TP;
}else if(HargaChandel >= 1.25){
double TP = 140;
result=TP;
}
};
if(Open[shift] > Close [shift]) {
if(HargaChandel1 <= 0.25){
double TP = MathCeil (HargaChandel1*220);
result=TP;
}else if(HargaChandel1 <= 0.50){
double TP = MathCeil (HargaChandel1*190);
result=TP;
}else if(HargaChandel1 <= 1){
double TP = MathCeil (HargaChandel1*120);
result=TP;
}else if(HargaChandel1 <= 1.15){
double TP= MathCeil (HargaChandel1*70);
result=TP;
}else if(HargaChandel1 >= 1.25){
double TP = 130;
result=TP;
}
};
return (result);
}
//Menghitung Lots
double MyLots(int shift=0){
double MyLots = NormalizeDouble((AccountBalance()/10000),2);
return (MyLots);
}
//Eksekusi Order
void NewOrder(int CMD,string myNotes="#Gie@PK_1.1"){
double pTP = 0, pSL=0, pMarket=0;
//ini merupakan jumlah buy
if(CMD==OP_BUY){
pMarket = Ask;
pTP = pMarket+TheTP()*Point();
pSL = pMarket-StopLoss*Point();
}
//ini merupakan jumlah sell
if(CMD==OP_SELL){
pMarket = Bid;
pTP = pMarket-TheTP()*Point();
pSL = pMarket+StopLoss*Point();
}
pTP = NormalizeDouble(pTP,Digits);
pSL = NormalizeDouble(pSL,Digits);
if(TheTP()<=20) {
if(CMD==OP_BUY){
pTP = pMarket+40*Point();
}
//ini merupakan jumlah sell
if(CMD==OP_SELL){
pTP = pMarket-40*Point();
}
};
if(StopLoss<=0) pSL = 0;
int ticket = OrderSend(Symbol(),CMD,Lots,pMarket,0,pSL,pTP,myNotes,Magic);
}
//================================================ SELESAI ===========================================================