忍者ブログ

forex tester2のインディケーターを自作

fx(外国為替証拠金取引)のトレードの練習やルールの検証をForex Tester 2というソフトでしてみます。 Meta Trader4(MT4)のインディケーター(indicator)をForex Tester2用に移植できたらしてみます。

カテゴリー:NYボックス BreakOut-EAGLE__ut2DaMax.mq4

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。


BreakOut-EAGLE__ut2DaMax.mq4 みたいなの移植成功

BreakOut-EAGLE__ut2DaMax.mq4 に似たのが完成しました。
これくらいのことで徹夜しました。4流プログラマー以下です。

Forex Tester2には矩形(OBJ_RECTANGLE)のオブジェクトが無いようなので
4本の線で代用しました。

下手なコードですがCalculateだけ晒します。

procedure Calculate(index: integer); stdcall; var timestr, objnumstr: String; timeindex: TDateTime; begin if (index <> 0) then exit; if oldBars > Bars then exit; timeindex := Time(index); timestr := TimeToStr(timeindex); objnumstr := IntToStr(objnum); if (mode = 0) then begin if StrLComp(PChar(timestr),PChar('21:00:00'),4) = 0 then begin highp := High(index); lowp := Low(index); if ObjectExists(objnumstr+'l') then begin ObjectDelete(objnumstr+'l'); ObjectDelete(objnumstr+'u'); ObjectDelete(objnumstr+'d'); ObjectDelete(objnumstr+'r'); end; ObjectCreate(objnumstr+'l', obj_TrendLine, 0,timeindex, highp,timeindex, lowp); ObjectCreate(objnumstr+'u', obj_TrendLine, 0,timeindex, highp,timeindex, highp); ObjectCreate(objnumstr+'d', obj_TrendLine, 0,timeindex, lowp, timeindex, lowp); // create text if ObjectExists(objnumstr+'t1') then begin ObjectDelete(objnumstr+'t1'); ObjectDelete(objnumstr+'t2'); end; ObjectCreate(objnumstr+'t1', obj_Text, 0, timeindex, highp); ObjectSetText(objnumstr+'t1', FloatToStr(highp), 12, 'Arial', clYellow); ObjectSet(objnumstr+'t1', OBJPROP_VALIGNMENT, tlBottom); ObjectSet(objnumstr+'t1', OBJPROP_HALIGNMENT, taLeftJustify); ObjectCreate(objnumstr+'t2', obj_Text, 0, timeindex, lowp); ObjectSetText(objnumstr+'t2', FloatToStr(lowp), 12, 'Arial', clYellow); ObjectSet(objnumstr+'t2', OBJPROP_VALIGNMENT, tlTop); ObjectSet(objnumstr+'t2', OBJPROP_HALIGNMENT, taLeftJustify); mode := 1; end; end else if (mode = 1) then begin if (highp < high(index)) then highp := high(index); if (lowp > low(index)) then lowp := low(index); ObjectSet(objnumstr+'l', OBJPROP_PRICE1, highp); ObjectSet(objnumstr+'l', OBJPROP_PRICE2, lowp); ObjectSet(objnumstr+'u', OBJPROP_PRICE1, highp); ObjectSet(objnumstr+'u', OBJPROP_PRICE2, highp); ObjectSet(objnumstr+'u', OBJPROP_TIME2, timeindex); ObjectSet(objnumstr+'d', OBJPROP_PRICE1, lowp); ObjectSet(objnumstr+'d', OBJPROP_PRICE2, lowp); ObjectSet(objnumstr+'d', OBJPROP_TIME2, timeindex); // set text props ObjectSet(objnumstr+'t1', OBJPROP_TIME1, timeindex); ObjectSet(objnumstr+'t1', OBJPROP_PRICE1, highp); ObjectSet(objnumstr+'t2', OBJPROP_TIME1, timeindex); ObjectSet(objnumstr+'t2', OBJPROP_PRICE1, lowp); ObjectSetText(objnumstr+'t1', FloatToStr(highp), 12, 'Arial', clYellow); ObjectSetText(objnumstr+'t2', FloatToStr(lowp), 12, 'Arial', clYellow); if StrLComp(PChar(timestr),PChar('5:00:00'), 3) = 0 then begin mode := 2; if not(ObjectExists(objnumstr+'r')) then ObjectCreate(objnumstr+'r', obj_TrendLine, 0, timeindex, highp, timeindex, lowp); highp2 := highp; lowp2 := lowp; mode2 := 0; end; end else if (mode = 2) then begin ObjectSet(objnumstr+'u', OBJPROP_TIME2, timeindex); ObjectSet(objnumstr+'d', OBJPROP_TIME2, timeindex); if ((mode2 = 0) and (highp2 < Close(index))) or ((mode2 = 1) and (highp2 <= high(index))) then begin highp2 := high(index); if ObjectExists(objnumstr+'t3') then ObjectDelete(objnumstr+'t3'); ObjectCreate(objnumstr+'t3', obj_Text, 0, timeindex, highp2); ObjectSetText(objnumstr+'t3', FloatToStr(highp2), 12, 'Arial', clWhite); ObjectSet(objnumstr+'t3', OBJPROP_VALIGNMENT, tlBottom); ObjectSet(objnumstr+'t3', OBJPROP_HALIGNMENT, taLeftJustify); if mode2 = 0 then begin lowp2 := low(index); mode2 := 1; end; end; if ((mode2 = 0) and (lowp2 > Close(index))) or ((mode2 = 1) and (lowp2 >= low(index))) then begin lowp2 := low(index); if ObjectExists(objnumstr+'t4') then ObjectDelete(objnumstr+'t4'); ObjectCreate(objnumstr+'t4', obj_Text, 0, timeindex, lowp2); ObjectSetText(objnumstr+'t4', FloatToStr(lowp2), 12, 'Arial', clWhite); ObjectSet(objnumstr+'t4', OBJPROP_VALIGNMENT, tlTop); ObjectSet(objnumstr+'t4', OBJPROP_HALIGNMENT, taLeftJustify); if mode2 = 0 then begin highp2 := high(index); mode2 := 1; end; end; if StrLComp(PChar(timestr),PChar('20:00:00'), 4) = 0 then begin objnum := objnum+1; if objnum > 10 then begin objnum := 0; end; mode := 0; end; end; oldbars := Bars; end;

赤い枠がNYボックスです。まだ時間は合わせていません。
黄色い文字がNYボックスの高値と安値です。
高値と安値を超えたら白い文字が表示されます。



動画もアップしてみました。

PR

『NYボックス』の検証

『NYボックス』という手法があります。
日本時間にNY時間の高値と安値をブレイクしたらその方向にXXpip以上動くことが
多いことを利用する手法です。
ブレイクしてもXXpip動かなかったら反対の方向に動くことが多いことも利用します。

それを検証するためにインディケーターを探していたら
Meta Trader4用のが2つ見つかりました。

Sessions.mq4
 

BreakOut-EAGLE__ut2DaMax.mq4
 

BreakOut-EAGLE__ut2DaMax.mq4  
のほうがわかりやすいので移植に挑戦してみたいと思います。
 




forex tester2 販売
Forex Tester 2の購入はこちらから。
カレンダー
03 2024/04 05
S M T W T F S
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
カテゴリー
フリーエリア



最新記事
最新CM
最新TB
RSS
ブログ内検索
アーカイブ
最古記事
プロフィール
HN:
fx練習生
年齢:
49
性別:
男性
誕生日:
1975/04/03
職業:
夢は専業トレーダー
趣味:
fx
自己紹介:
fxの専業トレーダーになって経済的自由と時間的自由を手に入れたいです。
自分で売買ルールを作成してテストして自信をもってリアルトレードしたいです。
P R