tempe
Fun Poster
- Messages
- 150
- Joined
- Dec 8, 2007
- Messages
- 150
- Reaction score
- 20
- Points
- 15
Salam menyambut ramadhan...
masta...nk tnye ckit..
Katakan sya ingin membuat EA yg berkonsep Stochastic sebagai rule untuk OP..
S1M=iStochastic(NULL,PERIOD_M5,5,3,3,MODE_SMA,0,MODE_MAIN,0);
S1S=iStochastic(NULL,PERIOD_M5,5,3,3,MODE_SMA,0,MODE_SIGNAL,0);
S2M=iStochastic(NULL,PERIOD_M30,5,3,3,MODE_SMA,0,MODE_MAIN,0);
S2S=iStochastic(NULL,PERIOD_M30,5,3,3,MODE_SMA,0,MODE_SIGNAL,0);
S3M=iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_MAIN,0);
S3S=iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_SIGNAL,0);
S4M=iStochastic(NULL,PERIOD_W1,14,3,3,MODE_SMA,0,MODE_MAIN,0);
S4S=iStochastic(NULL,PERIOD_W1,14,3,3,MODE_SMA,0,MODE_SIGNAL,0);
Kemudian ingin menambah kepastian dengan Pivot..
Adakah cara ini boleh digunakan?
int week = 1;
double lastweek_high = iHigh(NULL,PERIOD_W1,week);
double lastweek_low = iLow(NULL,PERIOD_W1,week);
double lastweek_close = iClose(NULL,PERIOD_W1,week);
double R = lastweek_high - lastweek_low; //range
double p = (lastweek_high + lastweek_low + lastweek_close)/3; // Standard Pivot
double r5 = p + (R * 1.618);
double r4 = p + (R * 1.382);
double r3 = p + (R * 1.000);
double r2 = p + (R * 0.618);
double r1 = p + (R * 0.382);
double s1 = p - (R * 0.382);
double s2 = p - (R * 0.618);
double s3 = p - (R * 1.000);
double s4 = p - (R * 1.382);
double s5 = p - (R * 1.618);
if (ScanOpenTrades() == 0) Status = "READY";
Signal="NONE";
if(S1M>S1S && S2M>S2S && S3M>S3S && S4M>S4S && s5
|| S1M>S1S && S2M>S2S && S3M>S3S && S4M>S4S && s4
|| S1M>S1S && S2M>S2S && S3M>S3S && S4M>S4S && s3
|| S1M>S1S && S2M>S2S && S3M>S3S && S4M>S4S && s2
|| S1M>S1S && S2M>S2S && S3M>S3S && S4M>S4S && s1)
{
Signal="LONG";
}
if(S1M<S1S && S2M<S2S && S3M<S3S && S4M<S4S && r1
|| S1M<S1S && S2M<S2S && S3M<S3S && S4M<S4S && r2
|| S1M<S1S && S2M<S2S && S3M<S3S && S4M<S4S && r3
|| S1M<S1S && S2M<S2S && S3M<S3S && S4M<S4S && r4
|| S1M<S1S && S2M<S2S && S3M<S3S && S4M<S4S && r5)
{
Signal="SHORT";
}
Harap2 masta2 dan tuan2 skalian dapat bantu...nk tambah kepastian dengan pivot.
ps: Pivot sye ni konsep fibo pivot untuk weekly..
Tak jelas la cara mana tuan nak baca pivot tu... tapi, kalau cara bersilang, masta Aiman dah tunjukkan caranya...
Boleh jugak cuba simplified code kat bawah ni...
Code:
int i;
int week = 1;
int period_list[]={PERIOD_M5,PERIOD_M30,PERIOD_H1,PERIOD_W1};
double pivot_level[]={0.382,0.618,1,1.382,1.618};
double r[5];
double s[5];
double S_Main[4];
double S_Sig[4];
double lastweek_high = iHigh(NULL,PERIOD_W1,week);
double lastweek_low = iLow(NULL,PERIOD_W1,week);
double lastweek_close = iClose(NULL,PERIOD_W1,week);
double R = lastweek_high - lastweek_low; //range
double p = (lastweek_high + lastweek_low + lastweek_close)/3; // Standard Pivot
bool stochBuyOK = true;
bool stochSellOK = true;
bool supOK = false;
bool resOK = false;
string Signal = "NONE";
for(i=0;i<4;i++)
{
S_Main[i]=iStochastic(NULL,period_list[i],5,3,3,MODE_SMA,0,MODE_MAIN,0);
S_Sig[i]=iStochastic(NULL,period_list[i],5,3,3,MODE_SMA,0,MODE_SIGNAL,0);
}
for(i=0;i<5;i++)
{
r[i]=p + (R * pivot_level[i]);
s[i]=p - (R * pivot_level[i]);
}
for(i=0;i<4;i++)
{
stochBuyOK = stochBuyOK && S_Main[i]>S_Sig[i];
stochSellOK = stochSellOK && S_Main[i]<S_Sig[i];
}
for(i=0;i<5;i++)
{
supOK = supOK || (Open[0]<s[i] && Close[0]>s[i]);
resOK = resOK || (Open[0]>r[i] && Close[0]<r[i]);
}
if(stochBuyOK && supOK) Status="LONG";
if(stochSellOK && resOK) Status="SHORT";
