AmiBroker formula Language

Hi friends and seniors,
help me
This is an attempt (by a newbie) to draw MACD.
I want title like:
MACD Plot for:500343(PUDUMJEE)Daily - 3/12/2007MACD:M(12,26) = 1.3, Signal:S(12, 26, 9) = 1.2, Hist: H = 2

for that, i have written some code:

Code:
_SECTION_BEGIN("MACD Plot Title");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat(EncodeColor(colorGold)+"MACD Plot for:" + EncodeColor(colorBlue)+"{{NAME}}" 
						+ EncodeColor(colorRed) + "(" + FullName() + ") "
						+ EncodeColor(colorBlue) + "- {{INTERVAL}} {{DATE}}"));
_SECTION_END();

_SECTION_BEGIN("Plot MACD");
MACDName = StrFormat("MACD: M(" + macdStr + ") = " + WriteVal(MACDInd, 1.3));
	Plot( MACDInd, MACDName, myColor, ParamStyle("Style"));
_SECTION_END();

_SECTION_BEGIN("Plot Signal");
	//SignalName = StrFormat("Sig(" + sigStr + ") = " + WriteVal(SigInd,1.3));
	Plot( SigInd , StrFormat("Sig(" + sigStr + ") = " + WriteVal(SigInd,1.3)), colorBlue, ParamStyle("Style"));
_SECTION_END();

_SECTION_BEGIN("Plot Histogram");
	HistName = StrFormat("H = " + WriteVal(HistInd,1.3));
	Plot( HistInd, HistName, myColor, styleHistogram  | styleOwnScale | styleThick , -scaleHist * 1.2, scaleHist * 1.2);
_SECTION_END();
The problem is that I am getting
Title as defined in _N(Title...) but other parts are not coming in the title.
Infact all the things are coming in the interpretation window.

I wanted nothing in the interpretation window but everything in the title:

And also how to clear the interpretation window? like cls for dos.

Where am i doing wrong??
pls help
regards,
ashutosh
 

karthikmarar

Well-Known Member
Ashutosh

Try this...

Title = ("MACD Plot for " + Name()+" " + Date() +" "+Interval(2) +" "+ EncodeColor(colorLime)+",Open "+Open +" ,High "+H+" ,Low "+L+" ,Close "+C+" "+"{{VALUES}}");

regards

Karthik
 
Ashutosh

Try this...

Title = ("MACD Plot for " + Name()+" " + Date() +" "+Interval(2) +" "+ EncodeColor(colorLime)+",Open "+Open +" ,High "+H+" ,Low "+L+" ,Close "+C+" "+"{{VALUES}}");

regards

Karthik

Hey Karthik,
I tried your code. but again, i am unable to get what i want:

This is the Interpretation that is being printed on AB Interpretation window:

Code:
[B]MACD_Histogram
Date: 4/5/2007

Daily
MACD Plot for MARUTI 4/5/2007 Daily,O:746 ,H:763.9 ,L:741 ,C:755.9 {{VALUES}}
MACD: M(12,26) = -23.258
Sig(12,26,9) = -21.091
H = -2.167
Review of MARUTI UDYOG LIMITED (MARUTI)
as of 4/5/2007

Current Statistics

Close:  755.900
Change:    9.950
MACD Value:  -23.258
Signal Line:  -21.091[/B]
The MACD can provide buy/sell indications in three ways, signal line crossovers, overbought/oversold conditions, and divergences.

Crossovers:

Currently the MACD is bearish since it is trading below its signal line.
The MACD crossed below its signal line 1 period(s) ago.
Since the MACD crossed its moving average, MARUTI's price has increased    1.334%
And has ranged from a high of 768.000 to a low of 741.000

Overbought/Oversold

The MACD is not in an Overbought/Oversold range.

Divergence

There have been no divergence signals within the last 5 periods.
The problem is with the bold part.
The {{VALUES}} PORTION.

In the chart (attached as attachment): The initial part is in black, which i want as gold (i guess encodecolor() will do)

But, the values of macd signal or hist is being printed twice, One in black and one in color(pls see the chart);

this is the code snippet resulting in the double values in the chart (....I think)
Code:
_SECTION_BEGIN("MACD Plot Title");
	SetChartOptions(0,chartShowArrows|chartShowDates);
/*_N(Title = StrFormat(EncodeColor(colorGold)+"MACD Plot for:" + EncodeColor(colorBlue)+"{{NAME}}" 
						+ EncodeColor(colorRed) + "(" + FullName() + ") "
						+ EncodeColor(colorBlue) + "- {{INTERVAL}} {{DATE}}"));
*/
Title = ("MACD Plot for " + Name()+" " + Date() +" "+Interval(2)
	+ ",O:" + O + " ,H:" + H + " ,L:" + L + " ,C:" + C + " " + "{{VALUES}}");
_SECTION_END();

_SECTION_BEGIN("Plot MACD");
	MACDName = StrFormat("MACD: M(" + macdStr + ") = " + WriteVal(MACDInd, 1.3));
	Plot( MACDInd, MACDName, myColor, ParamStyle("Style"));
_SECTION_END();
Only code for MACD indicator section is attached, other two sections are like identical.
regards
ashutosh
 
Last edited:

karthikmarar

Well-Known Member
Hi Ashutosh

You have duplicate sections almost doing the same thing .

Title = ("MACD Plot for " + Name()+" " + Date() +" "+Interval(2)
+ ",O:" + O + " ,H:" + H + " ,L:" + L + " ,C:" + C + " " + "{{VALUES}}");
_SECTION_END();

_SECTION_BEGIN("Plot MACD");
MACDName = StrFormat("MACD: M(" + macdStr + ") = " + WriteVal(MACDInd, 1.3));
Plot( MACDInd, MACDName, myColor, ParamStyle("Style"));
_SECTION_END();

Did you try using one of them only.

regards

Karthik
 
Hi Ashutosh

You have duplicate sections almost doing the same thing .

Title = ("MACD Plot for " + Name()+" " + Date() +" "+Interval(2)
+ ",O:" + O + " ,H:" + H + " ,L:" + L + " ,C:" + C + " " + "{{VALUES}}");
_SECTION_END();

_SECTION_BEGIN("Plot MACD");
MACDName = StrFormat("MACD: M(" + macdStr + ") = " + WriteVal(MACDInd, 1.3));
Plot( MACDInd, MACDName, myColor, ParamStyle("Style"));
_SECTION_END();

Did you try using one of them only.

regards

Karthik
Thanks Boss,
finally got it right. You were correct, I used one and got the result. You are the man.

thanks again karthik
regards
ashutosh
 
R

ratan jain

Guest
you know what people, 10 years of looking at indicators, and have realised that pure price action is the way to make money.

follow price.....it keeps you objective.

Just my 2 cents....
 
Hi seniors,
i found a post in this forum by satya where he posted a program to calculate support resistance etc.
below is his post
Code:
Pivot, Support , Resistance Calculator 

--------------------------------------------------------------------------------

Friends,

just try this tool developed by me. It calculates automatically all the R3, R2, R1, Pivot , S1, S2, S3 points for the next day.

The input for this application is a flat file with stock quotes.
the zip files has 2 files

1. Pivot.exe the executable file you should run
2. stock.ini file, where you can store your favourite stocks(e.g infosys,hinlev,icici,wipro,satcom)

the names should match with the names in flat file.

let me know, if it works fine.
Satya
what i wanted is to plot the same using Amibroker AFL. is there any way to do it??
or else where can i find theory regarding the method to calculate R1, R2 etc..

regards
ashutosh
 
Hi seniors,
i found a post in this forum by satya where he posted a program to calculate support resistance etc.
below is his post
Code:
Pivot, Support , Resistance Calculator 

--------------------------------------------------------------------------------

Friends,

just try this tool developed by me. It calculates automatically all the R3, R2, R1, Pivot , S1, S2, S3 points for the next day.

The input for this application is a flat file with stock quotes.
the zip files has 2 files

1. Pivot.exe the executable file you should run
2. stock.ini file, where you can store your favourite stocks(e.g infosys,hinlev,icici,wipro,satcom)

the names should match with the names in flat file.

let me know, if it works fine.
Satya
what i wanted is to plot the same using Amibroker AFL. is there any way to do it??
or else where can i find theory regarding the method to calculate R1, R2 etc..

regards
ashutosh
There are a few Pivots related AFLS at the mother site (AB AFL Library). You will acheive total satisfaction there. :)
 

Similar threads