コーディングのヘルプ - ページ 110

 

こんにちは。

一つは wpr(Williams' Percent Range) とその ma (wpr with ma)、もう一つは cmo (chandemomentum osc.) で、2つのインディケータが必要です。

とそのMA(MA付きcmo)です。

どなたか教えてください。

ありがとうございます。

 
anonimm:
こんにちは。

一つは wpr(Williams' Percent Range) とその ma (wpr with ma)、もう一つは cmo (chande momentum osc.) で、2つのインディケータが必要です。

とそのMA(MA付きcmo)です。

誰か助けてください。

ありがとうございます。

anonimm

ここに平均値(ma)を持つ1つのWPRがあります。

ファイル:
wpr_ma.mq4  2 kb
 
mladen:
anonimm ここでは、平均値(MA)のあるWPRを一つ紹介します。

Mladenさん、ありがとうございます。

cmoのmaを試していますが、エラー(iCMO function not defined)が出てしまいます。

//---- インジケーターの設定

#プロパティ indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 シルバー

#property indicator_color2 レッド

#property indicator_width1 2 (プロパティ インジケータ幅1)

#property indicator_width2 2 (プロパティ インジケータ幅2)

//---- インジケーターのパラメーター

extern int CMO_Period=21;

extern int MA_Period=14;

extern string m = "--Moving Average Types--";

extern string m0 = " 0 = SMA";

extern string m1 = " 1 = EMA";

extern string m2 = " 2 = SMMA";

extern string m3 = " 3 = LWMA";

extern int MA_Type=1;

//----インジケーターバッファー

double CMO_Buffer[];

double MA_Buffer[];

double iCMO[];

int MA_Mode;

文字列 strMAType;

//+------------------------------------------------------------------+

//| カスタムインジケータ初期化関数

//+------------------------------------------------------------------+

int init()

{

//---- 描画設定

SetIndexStyle(0,DRAW_LINE)を設定します。

SetIndexStyle(1,DRAW_LINE)を設定します。

SetIndexDrawBegin(1,CMO_Period)。

インジケータDigits(Digits+1);

//---- インジケータ・バッファのマッピング

SetIndexBuffer(0,CMO_Buffer)を設定します。

SetIndexBuffer(1,MA_Buffer)を設定します。

//---- DataWindow とインジケータサブウィンドウのラベルの名前

switch (MA_Type)

{

case 1: strMAType="EMA"; MA_Mode=MODE_EMA; break;

case 2: strMAType="SMMA"; MA_MODE=MODE_SMMA; break;

case 3: strMAType="LWMA"; MA_Mode=MODE_LWMA; break;

デフォルト: strMAType="SMA"; MA_Mode=MODE_SMA; break; case 2: strMAType="LWMA"; MA_MODE_LWMA; break;

}

IndicatorShortName( "CMO" + " (" + CMO_Period + ") " + " : " + strMAType+ " (" +MA_Period + ") ");

SetIndexLabel(0, "CMO" + " (" +CMO_Period + ") ") を設定します。

SetIndexLabel(1,strMAType+ " (" + MA_Period + ") ");

//---- 初期化完了

return(0);

}

//+------------------------------------------------------------------+

//| 移動平均の収束・発散について

//+------------------------------------------------------------------+

int start()

{

int limit;

int counted_bars=IndicatorCounted();

//---- 最後にカウントされたバーが再カウントされる

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

//---- CMOは1stバッファでカウントされる

for(int i=0; i<limit; i++)

CMO_Buffer=iCMO(NULL,0,CMO_Period,i);

//---- 2番目のバッファにカウントされたMAライン

for(i=0; i<limit; i++)

MA_Buffer=iMAOnArray(CMO_Buffer,Bars,MA_Period,0,MA_Mode,i);

//----完了

return(0);

}

//+------------------------------------------------------------------+

ファイル:
cmo.mq4  6 kb
 

Mladen,エラーを見つける のを手伝ってくれますか?

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color2 Red

//----

double UpperBuf[];

double UpperBuf1[];

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void init()

{

SetIndexStyle(0, DRAW_NONE, STYLE_SOLID, 1);

//----

SetIndexDrawBegin(0, N);

//----

SetIndexBuffer(0, UpperBuf);

SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1);

//----

SetIndexDrawBegin(1, N);

//----

SetIndexBuffer(1, UpperBuf1);

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void deinit()

{

//----

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void start()

{

int counted = IndicatorCounted();

//----

if(counted < 0)

return (-1);

//----

if(counted > 0)

counted--;

int limit = Bars - counted;

//----

for(int i = 0; i < limit; i++)

{

UpperBuf= ((High/Close)-34)*Volume;

UpperBuf1= iMAOnArray(UpperBuf,0,33,0,MODE_EMA,i);

}

}

//+------------------------------------------------------------------+

 
anonimm:
Mladenさん、ありがとうございました。

cmoのmaを試していますが、エラー(iCMO function not defined)になります。

//---- インジケーターの設定

#プロパティ indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 シルバー

#property indicator_color2 レッド

#property indicator_width1 2 (プロパティ インジケータ幅1)

#property indicator_width2 2 (プロパティ インジケータ幅2)

//---- インジケーターのパラメーター

extern int CMO_Period=21;

extern int MA_Period=14;

extern string m = "--Moving Average Types--";

extern string m0 = " 0 = SMA";

extern string m1 = " 1 = EMA";

extern string m2 = " 2 = SMMA";

extern string m3 = " 3 = LWMA";

extern int MA_Type=1;

//---- インジケーターバッファー

double CMO_Buffer[];

double MA_Buffer[];

double iCMO[];

int MA_Mode;

文字列 strMAType;

//+------------------------------------------------------------------+

//| カスタムインジケータ初期化関数

//+------------------------------------------------------------------+

int init()

{

//---- 描画設定

SetIndexStyle(0,DRAW_LINE)を設定します。

SetIndexStyle(1,DRAW_LINE)を設定します。

SetIndexDrawBegin(1,CMO_Period)。

インジケータDigits(Digits+1);

//---- インジケータ・バッファのマッピング

SetIndexBuffer(0,CMO_Buffer)を設定します。

SetIndexBuffer(1,MA_Buffer)を設定します。

//---- DataWindow とインジケータサブウィンドウのラベルの名前

switch (MA_Type)

{

case 1: strMAType="EMA"; MA_Mode=MODE_EMA; break;

case 2: strMAType="SMMA"; MA_MODE=MODE_SMMA; break;

case 3: strMAType="LWMA"; MA_Mode=MODE_LWMA; break;

デフォルト: strMAType="SMA"; MA_Mode=MODE_SMA; break; case 2: strMAType="LWMA"; MA_MODE_LWMA; break;

}

IndicatorShortName( "CMO" + " (" + CMO_Period + ") " + " : " + strMAType+ " (" +MA_Period + ") ");

SetIndexLabel(0, "CMO" + " (" +CMO_Period + ") ") を設定します。

SetIndexLabel(1,strMAType+ " (" + MA_Period + ") ");

//---- 初期化完了

return(0);

}

//+------------------------------------------------------------------+

//| 移動平均の収束・発散について

//+------------------------------------------------------------------+

int start()

{

int limit;

int counted_bars=IndicatorCounted();

//---- 最後にカウントされたバーが再カウントされる

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

//---- CMOは1stバッファでカウントされる

for(int i=0; i<limit; i++)

CMO_Buffer=iCMO(NULL,0,CMO_Period,i);

//---- 2番目のバッファにカウントされたMAライン

for(i=0; i<limit; i++)

MA_Buffer=iMAOnArray(CMO_Buffer,Bars,MA_Period,0,MA_Mode,i);

//----完了

return(0);

}

//+------------------------------------------------------------------+

追記:スタンドアロン版なので、cmoは不要です。

ファイル:
cmo_ma.mq4  2 kb
 
k3rn3l:
Mladen、あなたは私がエラーを見つけるのを助けることができますか?

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color2 Red

//----

double UpperBuf[];

double UpperBuf1[];

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void init()

{

SetIndexStyle(0, DRAW_NONE, STYLE_SOLID, 1);

//----

SetIndexDrawBegin(0, N);

//----

SetIndexBuffer(0, UpperBuf);

SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1);

//----

SetIndexDrawBegin(1, N);

//----

SetIndexBuffer(1, UpperBuf1);

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void deinit()

{

//----

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void start()

{

int counted = IndicatorCounted();

//----

if(counted < 0)

return (-1);

//----

if(counted > 0)

counted--;

int limit = Bars - counted;

//----

for(int i = 0; i < limit; i++)

{

UpperBuf= ((High/Close)-34)*Volume;

UpperBuf1= iMAOnArray(UpperBuf,0,33,0,MODE_EMA,i);

}

}

//+------------------------------------------------------------------+

k3rn3l

このように試してみてください。

#property indicator_separate_window

#property indicator_buffers 1

#property indicator_color1 Red

double UpperBuf[];

double UpperBuf1[];

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

void init()

{

IndicatorBuffers(2);

SetIndexBuffer(0, UpperBuf1);

SetIndexBuffer(1, UpperBuf);

}

void deinit() {}

void start()

{

int counted = IndicatorCounted();

if(counted < 0) return (-1);

if(counted > 0) counted--;

int limit = Bars - counted;

for(int i = 0; i < limit; i++)

if (Close!=0)

UpperBuf= ((High/Close)-34)*Volume;

else UpperBuf= 0;

for( i = 0; i < limit; i++) UpperBuf1= iMAOnArray(UpperBuf,0,33,0,MODE_EMA,i);

}
 

ムラデン様。

wprのmaとcmoのmaの指標について、再度ありがとうございました。最初の指標でwpr perをaに、ma perをbに、2番目の指標でcmoレンジをcに、ma perをdに設定したと仮定します。(ここが重要 です。2つの条件が同時に発生する必要があります)そして、逆の条件を売ります。

それは可能ですか?

 
anonimm:
Mladenさんへ。

また、wprのmaとcmoのmaの指標をありがとうございました。最初の指標でwpr perをaに、ma perをbに、2番目の指標でcmo rangeをcに、ma perをdに設定したと仮定します。(ここが重要で、2つの条件が同時に発生する必要があります)、および逆条件を販売しています。

それは可能ですか?

そうです。

それは可能です。

iCustom() を使って、探している条件をチェックし、いくつのカスタムインジケーターの条件を組み合わせて、一つのシグナルにすることができます。

 

950本以上のカウントバーがあるのですが、どなたかこのインジケーターを修正するのを手伝っていただけませんか?

ファイル:
 
YSCWL:
950本以上のカウントバーがある場合、このインディケータを修正するのを手伝ってくれる人はいますか?

試してみる

ファイル: