jadi kodingannya:
if(close[0]> upper band)
{ ordersend OP_SELL blablabla)
trus kalau harga berada di bawah lower band, maka ane akan pasang posisi buy
so, kodingannya:
if(close[0]< lower band)
{ordersend OP_BUY blablabla}
skalian kalau ada kode untuk middle band apa??
ane udah coba cari di help menu namun tidak ada... thanks ya bagi yang mau bantu
--------------------
PHP Code:
//+------------------------------------------------------------------+
//| Input variables |
//+------------------------------------------------------------------+extern int BB_Period = 96;int start()
{
double upperband, middleband,lowerband;
upperband_0=iBands(NULL,0,BB_Period,2,0,PRICE_WEIGHTED,MODE_UPPER,0)
middleband_0=iBands(NULL,0,BB_Period,2,0,PRICE_WEIGHTED,0,0)
lowerband_0=iBands(NULL,0,BB_Period,2,0,PRICE_WEIGHTED,MODE_LOWER,0)
if(.......)
{...........;
}
}
Null = simbol dimana Band di baca
0= tf yang digunakan // bisa di isi TF_PeriodM5 utk TF M5...PeriodM60 utk tf H1
BB_Period=variable periode
2=Band deviation // bisa juga di extern
0= lupa
PRICE_WEIGHTED=price Apply to
MODE_UPPER=utk line atas, 0 utk line tengah, MODE_LOWER utk line bawah
0=bar saat ini/ shift 0, 1 utk lastbar , 2 dst...utk bar ke 2 kebelakang
semoga membantu...
ati2 pake band kalo strategi spt itu...kalo kena breakout....bisa MC, harus pake filter dan riskmanagement lho
-----------------------------------
thanks gan atas penjelasannya,, ini akan langsung ane coba gan,,, trims ya... trus ane mau nanya berarti kalau ane mau OP_SELL saat harga menembus bolinger atas kode nya begini ya gan:
if (close[0]>UPPERBAND_0)
{
OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, Bid+TakeProfit, Bid-TakeProfit, EAComment, EAMagicNumber);
}
begitu ya gan?? maksudnya angka 'nol' di upperband itu apa seh?? kok agan tulis UPPERBAND_0??? kalau ditulis UPPERBAND saja gak bisa ya?
---------- Post added at 11:27 AM ---------- Previous post was at 10:40 AM ----------
permisi master-master koding.... bantu ane dong,, ini hasil kodingan ane:
PHP Code:
//+------------------------------------------------------------------+
//| belajar.mq4 |
//| oyi |
//| |
//+------------------------------------------------------------------+
#property copyright "oyi"
#property link "oyi"
extern int TakeProfit = 50;extern int PipStep = 50; extern int Slippage = 3; extern double Lots = 0.1;
string EAComment = "oyi"; int EAMagicNumber = 8095;//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+int init()
{//----
//----
return(0);
}//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+int deinit()
{//----
//----
return(0);
}//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+int start()
{
Comment("\nServer Time: ",Hour(),"\nPairs : ",Symbol(),"\nEquity : ",AccountEquity(),"\nBalance : ",AccountBalance()); // Tampilkan Nama EA di layar
double upperband, middleband,lowerband;
upperband=iBands(NULL,0,480,2,0,PRICE_CLOSE,MODE_UPPER,0);
middleband=iBands(NULL,0,480,2,0,PRICE_CLOSE,0,0);
lowerband=iBands(NULL,0,480,2,0,PRICE_CLOSE,MODE_LOWER,0);
if (Close[0]<lowerband)
{
OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, Ask-TakeProfit, Ask+TakeProfit, EAComment, EAMagicNumber);
}
if (Close[0]>upperband)
{
OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, Bid+TakeProfit, Bid-TakeProfit, EAComment, EAMagicNumber);
}
return(0);
}//+------------------------------------------------------------------+
------------------------------
if (Close[0]<lowerband)
{
OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, Ask-TakeProfit, Ask+TakeProfit, EAComment, EAMagicNumber);
}
if (Close[0]>upperband)
{
OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, Bid+TakeProfit, Bid-TakeProfit, EAComment, EAMagicNumber);
nah seharusnya dari coding itu open position BUY dilakukan saat harga tembus BB bawah, trus OP_SELL dilakukan saat harga close sekarang tembus BB atas,,, namun kenyataannya tidak ada open position sama sekali gan
---------------------------------------
nah, yang jadi masalah kok gak mau Open position yah?? apabila harga close sekarang > nilai middle band ane buka posisi BUY, tapi kok gak mau Open yah,??? bantu dong
OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, Ask-TakeProfit, Ask+TakeProfit, EAComment, EAMagicNumber);
yang saya bold itu bukan tipe integer
--------------------------------------------
apakah kesalahannya gara-gara itu aja gan???
masalah integer bukankah ane udah deklarasikan di awal? nih deklarasinya:
extern int TakeProfit = 50;
extern int PipStep = 50;
extern int Slippage = 3;
extern double Lots = 0.1;
---------- Post added at 07:17 PM ---------- Previous post was at 06:27 PM ----------
permisi agan-agan semuanya..... problem nya udah solved nih... thanks banget ya bantuannya...
ini ane sertakan kode BB buatan ane sendiri (ane nubi banget nih,, gak pernah programming soalnya)
PHP Code:
if (OrdersTotal()==0)
{
if (Close[0]>middleband)
{
OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask-0.005, Ask+0.005, EAComment, EAMagicNumber);
return;
}
else if (Close[0]<middleband)
{
OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, Bid+0.005, Bid-0.005, EAComment, EAMagicNumber);
return;
}
}
}
rasanya tidak convenience gan
-----------------------------------------
tinggal di kalikan Point aja....
jadi kodenya:
OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, Ask-TakeProfit*Point, Ask+TakeProfit*Point, EAComment, EAMagicNumber);
tapi perlu di ingat....kode ente TP sama SL nya kan menggunakan 1 parameter...so nilainya harus diatas "MarketInfo(Symbol(),MODE_STOPLEVEL) + spread".
---------------------------------------
No comments:
Post a Comment