| / | Forum |
|
Llamedos
2010.12.21 20:23
|
|
Testing Visualization: Manual Trading Testing manual strategies on history. Check how your trading algorithm works turning a deaf ear to programming niceties! |
1935 |
BarrowBoy
2010.12.21 20:53
L Very basic example If you're showing a higher timeframe indicator on a lower, this wont show any history - you just get a straight line when you first put it on the chart Does show how much the leading edge of almost all indicators does waggle around in live trading... #property copyright "Copyright © 2010, SelectFX" #property link "http://www.selectfx.net" #property indicator_chart_window #property indicator_buffers 1 //---- #property indicator_color1 Red extern int DataPeriod = 8; // The period to use of the MA on the other timeframe extern int TimeFrameSwitch = 4; // 1=M1 - 9=MN1 - done this way to make backtesting easier with an EA ;) extern int LTT.MaMethod = 1; // 0=SMA 1=EMA 2=Smoothed 3=LWMA extern int CurrentBar = 0; int shift, limit, counted_bars, TimeFrame; string strSymbol; //---- double Buffer0[]; static bool IsInitialLoad; /* SFX AnyMAAnyPeriod.mq4 */ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void init() { SetIndexBuffer(0, Buffer0); SetIndexStyle (0, DRAW_LINE, STYLE_SOLID, 1); SetIndexLabel(0, "Buffer0"); IsInitialLoad = true; //---- name for DataWindow and indicator subwindow label IndicatorShortName("SFX Any MA Any Period"); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void deinit() {} //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { strSymbol = Symbol(); TimeFrame = TimeFrameSwitcher(TimeFrameSwitch); counted_bars=IndicatorCounted(); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(shift = 0; shift < limit; shift++) { // First Indicator Data Buffer0[shift] = iMA(strSymbol, TimeFrame, DataPeriod, 0, LTT.MaMethod, PRICE_CLOSE, CurrentBar+0); } } //+------------------------------------------------------------------+ int TimeFrameSwitcher(int iSP) { // Takes a number 1-9 returns a chart period int iP=0; switch (iSP) { case 1: iP=PERIOD_M1; break; case 2: iP=PERIOD_M5; break; case 3: iP=PERIOD_M15; break; case 4: iP=PERIOD_M30; break; case 5: iP=PERIOD_H1; break; case 6: iP=PERIOD_H4; break; case 7: iP=PERIOD_D1; break; case 8: iP=PERIOD_W1; break; case 9: iP=PERIOD_MN1; break; } return(iP); } FWIW -BB- |
|
qjol
2010.12.21 22:14
it's very simple just put MA * 6 on 5 min chart == ma 30 min chart for example if u want 10 Ma simple on 30 min chart, on 5 min chart put 60 MA simple (30/5 =6 - 10*6 = 60) |