×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
fx(外国為替証拠金取引)のトレードの練習やルールの検証をForex Tester 2というソフトでしてみます。 Meta Trader4(MT4)のインディケーター(indicator)をForex Tester2用に移植できたらしてみます。
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
procedure Calculate(index: integer); stdcall; var timeindex: TDateTime; nowdaystr: string; nowday: Word; nowhour: word; begin if first = 0 then begin if AsiaEndTime <= AsiaBeginTime then AsiaEndTime := AsiaBeginTime + 1; first := 1; print(IntToStr(AsiaBeginTime) + ' ' + IntToStr(AsiaEndTime)); end; if (index <> 0) then exit; timeindex := Time(index); nowday := DayOf(timeindex); nowhour := HourOf(timeindex); nowdaystr := IntToStr(nowday); case modeA of 0: begin if nowhour = AsiaBeginTime then begin AsiaMax := High(index); AsiaMin := Low(index); AsiaObjectName := 'A' + nowdaystr; if not(ObjectExists(AsiaObjectName + 'u')) then begin ObjectCreate(AsiaObjectName + 'u', obj_TrendLine, 0, timeindex, 0, timeindex, 0); ObjectCreate(AsiaObjectName + 'd', obj_TrendLine, 0, timeindex, 0, timeindex, 0); ObjectCreate(AsiaObjectName + 'l', obj_TrendLine, 0, timeindex, 0, timeindex, 0); ObjectCreate(AsiaObjectName + 'r', obj_TrendLine, 0, timeindex, 0, timeindex, 0); ObjectSet(AsiaObjectName + 'u', OBJPROP_COLOR, AsiaColor); ObjectSet(AsiaObjectName + 'd', OBJPROP_COLOR, AsiaColor); ObjectSet(AsiaObjectName + 'l', OBJPROP_COLOR, AsiaColor); ObjectSet(AsiaObjectName + 'r', OBJPROP_COLOR, AsiaColor); ObjectSet(AsiaObjectName + 'u', OBJPROP_WIDTH, 3); ObjectSet(AsiaObjectName + 'd', OBJPROP_WIDTH, 3); ObjectSet(AsiaObjectName + 'l', OBJPROP_WIDTH, 3); ObjectSet(AsiaObjectName + 'r', OBJPROP_WIDTH, 3); end; ObjectSet(AsiaObjectName + 'l', OBJPROP_TIME1, timeindex); ObjectSet(AsiaObjectName + 'l', OBJPROP_PRICE1, AsiaMax); ObjectSet(AsiaObjectName + 'l', OBJPROP_TIME2, timeindex); ObjectSet(AsiaObjectName + 'l', OBJPROP_PRICE2, AsiaMin); ObjectSet(AsiaObjectName + 'u', OBJPROP_TIME1, timeindex); ObjectSet(AsiaObjectName + 'u', OBJPROP_PRICE1, AsiaMax); ObjectSet(AsiaObjectName + 'u', OBJPROP_TIME2, timeindex); ObjectSet(AsiaObjectName + 'u', OBJPROP_PRICE2, AsiaMax); ObjectSet(AsiaObjectName + 'd', OBJPROP_TIME1, timeindex); ObjectSet(AsiaObjectName + 'd', OBJPROP_PRICE1, AsiaMin); ObjectSet(AsiaObjectName + 'd', OBJPROP_TIME2, timeindex); ObjectSet(AsiaObjectName + 'd', OBJPROP_PRICE2, AsiaMin); if not(ObjectExists('Atu')) then begin ObjectCreate('Atu', obj_Text, 0, 0, 0); ObjectSet('Atu', OBJPROP_VALIGNMENT, tlBottom); ObjectSet('Atu', OBJPROP_HALIGNMENT, taRightJustify); ObjectCreate('Atd', obj_Text, 0, 0, 0); ObjectSet('Atd', OBJPROP_VALIGNMENT, tlTop); ObjectSet('Atd', OBJPROP_HALIGNMENT, taRightJustify); end; ObjectSet('Atu', OBJPROP_TIME1, timeindex); ObjectSet('Atu', OBJPROP_PRICE1, AsiaMax); ObjectSetText('Atu', FloatToStr(AsiaMax)); ObjectSet('Atd', OBJPROP_TIME1, timeindex); ObjectSet('Atd', OBJPROP_PRICE1, AsiaMin); ObjectSetText('Atd', FloatToStr(AsiaMin)); AsiaEndTime2 := IncHour(timeindex, AsiaEndTime - AsiaBeginTime); modeA := 1; end; end; 1: begin if AsiaMax < High(index) then begin AsiaMax := High(index); ObjectSet(AsiaObjectName + 'l', OBJPROP_PRICE1, AsiaMax); ObjectSet(AsiaObjectName + 'u', OBJPROP_PRICE1, AsiaMax); ObjectSet(AsiaObjectName + 'u', OBJPROP_PRICE2, AsiaMax); ObjectSet('Atu', OBJPROP_PRICE1, AsiaMax); ObjectSetText('Atu', FloatToStr(AsiaMax)); end; if AsiaMin > Low(index) then begin AsiaMin := Low(index); ObjectSet(AsiaObjectName + 'l', OBJPROP_PRICE2, AsiaMin); ObjectSet(AsiaObjectName + 'd', OBJPROP_PRICE1, AsiaMin); ObjectSet(AsiaObjectName + 'd', OBJPROP_PRICE2, AsiaMin); ObjectSet('Atd', OBJPROP_PRICE1, AsiaMin); ObjectSetText('Atd', FloatToStr(AsiaMin)); end; ObjectSet(AsiaObjectName + 'u', OBJPROP_TIME2, timeindex); ObjectSet(AsiaObjectName + 'd', OBJPROP_TIME2, timeindex); ObjectSet('Atu', OBJPROP_TIME1, timeindex); ObjectSet('Atd', OBJPROP_TIME1, timeindex); if timeindex >= AsiaEndTime2 then begin ObjectSet(AsiaObjectName + 'u', OBJPROP_TIME2, AsiaEndTime2); ObjectSet(AsiaObjectName + 'd', OBJPROP_TIME2, AsiaEndTime2); ObjectSet(AsiaObjectName + 'r', OBJPROP_TIME1, AsiaEndTime2); ObjectSet(AsiaObjectName + 'r', OBJPROP_PRICE1, AsiaMax); ObjectSet(AsiaObjectName + 'r', OBJPROP_TIME2, AsiaEndTime2); ObjectSet(AsiaObjectName + 'r', OBJPROP_PRICE2, AsiaMin); ObjectSet('Atu', OBJPROP_TIME1, AsiaEndTime2); ObjectSet('Atd', OBJPROP_TIME1, AsiaEndTime2); modeA := 0; end; end; end; end;
procedure Init; stdcall; begin IndicatorShortName('i-session'); SetOutputWindow(ow_ChartWindow); IndicatorBuffers(0); if not(ObjectExists('t1')) then begin print('create object t1 in Init'); if ObjectCreate('t1', obj_Text, 0, 0, 0) then print('ok') else print('ng'); ObjectSetText('t1', 'Init', 12, 'Arial', clYellow); end; end; procedure Done; stdcall; begin ObjectDelete('t1'); end; procedure Calculate(index: integer); stdcall; begin if (index <> 0) or (Bars < 80) then exit; print(IntToStr(Timeframe())); if not(ObjectExists('t1')) then begin print('create object t1 in Calc'); if ObjectCreate('t1', obj_Text, 0, 0, 0) then print('ok') else print('ng'); end; ObjectSetText('t1', FormatDateTime('YYYY/MM/DD HH:MM:SS',Time(0)), 12, 'Arial', clYellow); ObjectSet('t1', OBJPROP_TIME1, Time(0)); ObjectSet('t1', OBJPROP_PRICE1, High(0)); end;
10 | 2024/11 | 12 |
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 |