How to plot higher TF MA in lower TF in Amibroker?

#11
tradepunt

please try the following

_SECTION_BEGIN("MTF MA");
SetChartOptions(2,chartShowDates);
GraphXSpace=5;
Plot(C,"",1,64);
PP = 0;
WDH = ParamList("TF", "Hourly,Daily,Weekly" );
if( WDH == "Daily" ) PP= inDaily;
if( WDH == "Weekly" ) PP= inWeekly;
if( WDH == "Hourly" ) PP= inHourly;
TimeFrameSet(PP);
P=ParamField("Price");
Per=Param("MA Period",20,1,200,1);
x=MA(P,Per);
TimeFrameRestore();
aa=TimeFrameExpand(x,PP);
Plot(aa,"",colorBlue,styleThick);
_SECTION_END();

Vidyasagar
Nice :)

The code is working for all 3 time frames :thumb:

Adding different MA types and Displacement parameters

Code:
_SECTION_BEGIN("MTF MA");
SetChartOptions(2,chartShowDates);
GraphXSpace=5;
Plot(C,"",1,64);
PP = 0;
WDH = ParamList("TF", "Hourly,Daily,Weekly" );
if( WDH == "Daily" ) PP= inDaily;
if( WDH == "Weekly" ) PP= inWeekly;
if( WDH == "Hourly" ) PP= inHourly; 
P = ParamField("Field");
Type = ParamList("Type", "Simple,Exponential,Double Exponential,Tripple Exponential,Wilders,Weighted");
Periods = Param("Periods", 20, 2, 300 );
Displacement = Param("Displacement", 0, -50, 50 );
m = 0;
TimeFrameSet(PP);
if( Type == "Simple" ) 					m = MA( P, Periods );
if( Type == "Exponential" ) 			m = EMA( P, Periods );
if( Type == "Double Exponential" ) 	m = DEMA( P, Periods );
if( Type == "Tripple Exponential" ) 	m = TEMA( P, Periods );
if( Type == "Wilders" ) 				m = Wilders( P, Periods );
if( Type == "Weighted" ) 				m = WMA( P, Periods );
TimeFrameRestore();
aa=TimeFrameExpand(m,PP);
Plot(aa, _DEFAULT_NAME(), ParamColor("Color", ColorCycle), ParamStyle("Style"), 0, 0, Displacement );
_SECTION_END();
 
Last edited:

KelvinHand

Well-Known Member
#13
how can u say its working fine?
did u get my requirement?
its 200DMA or any other higher TF DMA on a lower TF.
your code is a simple code available in default section!
There is nothing wrong with him doing freely code enhancement with options of different MA configuration. Theoretically, the code is working. Practically, Memory limitation, still not the fault of the code. You wouldn't know, one of this day, the amibroker improve the technology and extend to virtual memory, then there will no limitation at all.

It had proven to you, It just don't work on is only your live data setup not the cause of the script unless prove me wrong. So suggest you look for the software originator to ask for the answer is the best way. Tomasz Janeczko of Amibroker is the best person to answer your this problem.


I re-think over, there are something you can try out to see weather it work in your situation -
- Change the "base time interval" in the Database settings to different time 15min, 1hour to see whether on your Data Service Provider allow you to import data other then 1min from their side. If so then it may solve your issue. Also play around with the "Number of Bars" above it.

Then if work, see create 2 different Amibroker, one using 1min, one using other min to see whether it support.

If above cannot work and damn important to you, then just a concept which is the same as MT4 historical data, look for and hire a super expert programmer to do the feasibility study and programme script or plug-in into a way to convert and update the 1min data into different timeframe candle OHLCV and store it as separate data. Each time for this mtf_ma, load the data from file and work from there.
 
Last edited:
#14
i thot it ws as easy as it luks! thks anywys. will find d solution & post it (if u need it too)!!

There is nothing wrong with him doing freely code enhancement with options of different MA configuration. Theoretically, the code is working. Practically, Memory limitation, still not the fault of the code. You wouldn't know, one of this day, the amibroker improve the technology and extend to virtual memory, then there will no limitation at all.

It had proven to you, It just don't work on is only your live data setup not the cause of the script unless prove me wrong. So suggest you look for the software originator to ask for the answer is the best way. Tomasz Janeczko of Amibroker is the best person to answer your this problem.


I re-think over, there are something you can try out to see weather it work in your situation -
- Change the "base time interval" in the Database settings to different time 15min, 1hour to see whether on your Data Service Provider allow you to import data other then 1min from their side. If so then it may solve your issue. Also play around with the "Number of Bars" above it.

Then if work, see create 2 different Amibroker, one using 1min, one using other min to see whether it support.

If above cannot work and damn important to you, then just a concept which is the same as MT4 historical data, look for and hire a super expert programmer to do the feasibility study and programme script or plug-in into a way to convert and update the 1min data into different timeframe candle OHLCV and store it as separate data. Each time for this mtf_ma, load the data from file and work from there.
 
#15
hi PartTime_Trader!!

when i revisted this thread, though i didnt mean it, i realized i crudely replied 2u! pls dont mind it! :eek:

how can u say its working fine?
did u get my requirement?
its 200DMA or any other higher TF DMA on a lower TF.
your code is a simple code available in default section!

Nice :)

The code is working for all 3 time frames :thumb:

Adding different MA types and Displacement parameters
 

sudris

Well-Known Member
#16
you need 200DMA on an intraday timeframe chart.

do you have enough data to calculate 200DMA?
you will need aprox 10 months data to achieve the 200DMA plot
I believe none of the scrips you had tried your hands on had data for at least 10 months.

besides, which array you are using to calculate 200DMA?
you can play around "expandlast" and "expandfirst" modes when you try to expand the compressed TF. :cool:
 
#18
dear sudris - answer in 2 part!

yes i have more than 1 year's data in 1-min IEOD for many stocks! but still problem!

you need 200Ddo you have enough data to calculate 200DMA?
you will need aprox 10 months data to achieve the 200DMA plot
I believe none of the scrips you had tried your hands on had data for at least 10 months
sorry - i am a non techie & new to anibroker. thus cudnt get u!
besides, which array you are using to calculate 200DMA? you can play around "expandlast" and "expandfirst" modes when you try to expand the compressed TF. :cool:
thks anyways!:thumb:
 

KelvinHand

Well-Known Member
#19
dear sudris - answer in 2 part!

yes i have more than 1 year's data in 1-min IEOD for many stocks! but still problem!



sorry - i am a non techie & new to anibroker. thus cudnt get u!


thks anyways!:thumb:
Since you said that you got 1 year of IEOD, please display the 1min chart showing 1 year with the following code onto your chart window:

Save it into file name BarCount.afl. Record the 1st drag n drop into the chart which shown the max.
Code:
s = StrFormat("BarCount = %g", BarCount);
GfxSelectFont("Tahoma", 20, 700 ); 
GfxSetBkMode(1); 
GfxSetTextColor( colorYellow ); 
GfxTextOut( s, 20, 32 );
Let see what happen.
 
Last edited:

Similar threads