Kamis, 22 November 2012
EA Stochastic - Instant order
//+------------------------------------------------------------------+
//| Copyright © 2011, vgtechFX |
//| [url]http://www.vgtechFX.com[/url] |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, vgtechFX"
#property link "http://www.vgtechFX.com"
extern double xLotSize = 1;
extern double xTakeProfit = 10;
extern double xMGN = 112233;
datetime sudahordersell,sudahorderbuy;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//---- don't remove this line
if(ObjectFind("CC")!=0) ObjectCreate("CC", OBJ_LABEL, 0, 0, 0);
ObjectSet("CC", OBJPROP_CORNER, 3);
ObjectSet("CC", OBJPROP_XDISTANCE, 5);
ObjectSet("CC", OBJPROP_YDISTANCE, 5);
ObjectSet("CC", OBJPROP_BACK, true);
ObjectSetText("CC","Expert Advisor Copyright © "+Year()+", vgtechFX.Com", 13, "Arial", Silver);
//----
if(SignalBuy()==true && sudahorderbuy !=Time[0] )
{
OrderBuy();
}
if(SignalSell()==true && sudahordersell !=Time[0] )
{
OrderSell();
}
return(0);
}
//+------------------------------------------------------------------+
bool SignalBuy()
{
bool EntryBuy = false;
double BandHigh = iBands(NULL,0,20,1.5,0,PRICE_LOW,MODE_UPPER,2);
double BandLow = iBands(NULL,0,20,1.5,0,PRICE_LOW,MODE_LOWER,2);
double ValueStoch = iStochastic(NULL,0,10,5,5,MODE_SMA,0,MODE_MAIN,0);
double ValueStoch1 = iStochastic(NULL,0,10,5,5,MODE_SMA,0,MODE_SIGNAL,0);
if(Close[2] < BandLow && Open[1] < Close[1]
&& ValueStoch < 10 && ValueStoch1 < 10
)
{
EntryBuy = true;
}else{
EntryBuy = false;
}
return(EntryBuy);
}
bool SignalSell()
{
bool EntrySell = false;
double BandHigh = iBands(NULL,0,20,1.5,0,PRICE_LOW,MODE_UPPER,2);
double BandLow0 = iBands(NULL,0,20,1.5,0,PRICE_LOW,MODE_LOWER,2);
double ValueStoch = iStochastic(NULL,0,10,5,5,MODE_SMA,0,MODE_MAIN,0);
double ValueStoch1 = iStochastic(NULL,0,10,5,5,MODE_SMA,0,MODE_SIGNAL,0);
if(Close[2] > BandHigh && Open[1] > Close[1]
&& ValueStoch > 90 && ValueStoch1 > 90
)
{
EntrySell = true;
}else{
EntrySell = false;
}
return(EntrySell);
}
void OrderBuy()
{
int ticketbuy;
ticketbuy=OrderSend(Symbol(),OP_BUY,xLotSize,Ask,3,0,Ask + xTakeProfit*Point,"Order Jam : " + Hour() ,xMGN,0,Blue);
if(ticketbuy > 0)
{
sudahorderbuy = Time[0];
}
}
void OrderSell()
{
int ticketsell;
ticketsell=OrderSend(Symbol(),OP_SELL,xLotSize,Bid,3,0,Bid - xTakeProfit*Point,"Order Jam : " + Hour(),xMGN,0,Red);
if(ticketsell>0)
{
sudahordersell = Time[0];
}
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar