ANEKA SCRIPT ORDER DENGAN RISK MANAGEMENT


SCRIPT ORDER DENGAN RISK MANAGEMENT
::::BUY SCRIPT:::::
//+------------------------------------------------------------------+
//| Buy with MM |
//| Copyright © 2011, Rubianto |
//| Rubi_Sniper |
//+------------------------------------------------------------------+
#property copyright "Copyright © Rubi_Sniper_2011"
#property link "rubianto.md@gmail.com"
//#property show_inputs
extern double Lots = 1;
extern bool UseMoneyMgmt = true;
extern double RiskPercent = 5;
extern bool UseStop = true;
extern bool UseTakeProfit = true;
extern double StopLoss = 30;
extern double TakeProfit = 5;
extern string Note="0 in Entry field means Market Order Buy";
extern double Entry = 0.0000;
string Input = " Buy Price ";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_BUYSTOP;
if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT;
if (Entry == 0) {Entry = Ask; Mode = OP_BUY;}
double SLB = Entry - StopLoss*Point, TPB = Entry + TakeProfit*Point;
if (UseStop == false) SLB = 0;
if (UseTakeProfit == false) TPB = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2,SLB , TPB, "Rubi_Sniper_BUY", 0, NULL, LimeGreen);
return(0);
}
//+------------------------------------------------------------------+
::::SELL SCRIPT::::
//+------------------------------------------------------------------+
//| Sell with MM |
//| Copyright © 2011, Rubianto |
//| Rubi_Sniper |
//+------------------------------------------------------------------+
#property copyright "Copyright © Rubi_Sniper_2011"
#property link "rubianto.md@gmail.com"
//#property show_inputs
extern double Lots = 1;
extern bool UseMoneyMgmt = True;
extern double RiskPercent = 5;
extern bool UseStop = true;
extern bool UseTakeProfit = true;
extern double StopLoss = 30;
extern double TakeProfit = 5;
extern string Note="0 in Entry field means Market Order Sell";
extern double Entry = 0.0000;
string Input = " Sell Price ";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_SELLSTOP;
if (Bid < Entry && Entry > 0) Mode = OP_SELLLIMIT;
if (Entry == 0) {Entry = Bid; Mode = OP_SELL;}
double SLS = Entry+StopLoss*Point, TPS = Entry - TakeProfit * Point;
if (UseStop == false) SLS = 0;
if (UseTakeProfit == false) TPS = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2, SLS, TPS, "Rubi_Sniper_SELL",0, NULL, Red);
return(0);
}
//+------------------------------------------------------------------+
Script Buy n Sell dari bos Fkipoi Rian duet Taufik Kiads
SCRIPT BUY :
//====================================================
//IA1_script_buy_multiple.mq4
//depok.investor@gmail.com
//Note: Adjust lot1,takeprofit1 and stoploss1 as u like
//build:31/10/2011 taufik
//====================================================
#property copyright "IA1_2011"
#property link "depok.investor@gmail.com"
double lot1 =1.0;
int total_entry =5;
int takeprofit1 =5;
int stoploss1 =0;
int slippage1 =5;
int repeat =1;
int start()
{
while (repeat<=total_entry)
{
buy(lot1,takeprofit1,stoploss1,slippage1);
Sleep(1000);
int err=GetLastError();
if (err==0) {repeat++;}
else {repeat=repeat;}
}
}
void buy(double lot, double tp, double sl, int slip)
{
double askprice = Ask;
if (tp>0)tp = askprice + (tp * Point);
if (sl>0)sl = askprice - (sl *Point);
OrderSend(Symbol(), OP_BUY, lot, askprice, slip, sl, tp, "IA1_Buy-"+repeat, 0, 0, Blue);
return(0);
}
SCRIPT SELL :
//====================================================
//IA1_script_sell_multiple.mq4
//depok.investor@gmail.com
//Note: Adjust lot1,takeprofit1 and stoploss1 as u like
//build:31/10/2011 taufik
//====================================================
#property copyright "IA1_2011"
#property link "depok.investor@gmail.com"
double lot1 =1.0;
int total_entry =5;
int takeprofit1 =5;
int stoploss1 =0;
int slippage1 =5;
int repeat =1;
int start()
{
while (repeat<=total_entry)
{
sell(lot1,takeprofit1,stoploss1,slippage1);
Sleep(1000);
int err=GetLastError();
if (err==0) {repeat++;}
else {repeat=repeat;}
}
}
void sell(double lot, double tp, double sl, int slip)
{
double bidprice = Bid;
if (tp>0) tp = bidprice - (tp * Point);
if (sl>0) sl = bidprice + (sl * Point);
OrderSend(Symbol(), OP_SELL, lot, bidprice, slip, sl, tp, "IA1_Sell-"+repeat, 0, 0, Red);
return(0);
}