Simple Coding Help - No Promise.

All girls named ARTI have decided to change their names .... Rahul Gandhi used her name so many times but not once did he spell it right and hence they now feel disgusted and humilated
 

amitrandive

Well-Known Member
Dear All

Attached VAP code

Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("VAP");
segments = IIf( Interval() < inDaily, Day(), Month() );
segments = segments != Ref( segments , -1 );

PlotVAPOverlayA( segments , Param("Lines", 300, 100, 1000, 1 ), Param("Width", 80, 1, 100, 1 ), ParamColor("Color", colorGold ), ParamToggle("Side", "Left|Right" ) | 2 * ParamToggle("Style", "Fill|Lines", 0) | 4*ParamToggle("Z-order", "On top|Behind", 1 ) );
Plot(segments, "", colorLightGrey, styleHistogram | styleOwnScale );
_SECTION_END();
Can we have horizontal lines drawn at maximum VAP as shown in the sketch?
 
What is name of the Indicator in MT4?

As you do already know, standard ATR is simply average of High - Low. in this variation, you've done a criss-cross between previous High/Low with Close price.

What you need to do to confirm accuracy is to get Amibroker to compute over same scrip and since you cannot import data into MT4, only choice left is to get data from MT4 into Ami.
The Indicator is LFL-ATRProjections
https://dl.dropboxusercontent.com/u/86519074/LFL-ATRprojections.ex4
 

Nehal_s143

Well-Known Member
Nehal,

To be frank, I am just few months old in these areas and even I wouldnt bet money on my opinions.

I have seen that there are any number of methods to get the historical support/resistance. Now, which is better - I have no idea. Today I am just trying to see if the strength of a support/resistance level can be established. If a particular level is reported by these multiple methods, that could indicate strength. Or if that price level acted as a turning point more than once, that could also indicate strength.

Second part of the problem is automating this evaluation and effectively displaying this information in a chart. I dont see any immediate conclusion to this. But when I do get to a point that I believe is worthwhile your time, I will share it here.

btw, thanks for starting me on this thought.
Sir, one method which may reduce lines as similar level is to set look back period, if we dont use look back period, lines will get plotted from day one of data, hence we may get many lines around some level, for eg. in Nifty around 6300 on EOD daily chart, if look back period function is used, we may get less no. of lines around 6300 level
 
happyji, i am looking for an ma crossover system , based on 4 ma,

buy when 10 ma cross above 20 ma , when 50 ma is above 100 ma
sell when 10 ma cross below 20 ma , when 50 ma is below 100 ma.

pls give me the code for the above , you can also guide me to any trading system which are based on the above concept , that smaller TF ma crossover in the direction of the larger TF trend.
 

pratapvb

Well-Known Member
How do I find at which the crossover actually happened in amibroker?

Say I generate buy signal on open and psar crossover and sell signal when psar and open crossover..... How to get the price when the crossover actually happened? Say the last traded price at that moment and store in a variable to be shown on chart?

P.S. I have tried using GetRTData but it gives me an empty value. And I am bringing in feed from google.
why u need....u can roughly get the values when last it happened from the values of criteria at crossover bar itself no

below code is just written here as a guideline and written for buy side...not tested

psar = ..... ;

op = timeframegetprice("O", indaily) ;

buy = cross(op, psar) ;

buyprice = valuewhen(buy, psar) ;
 

Nehal_s143

Well-Known Member
happyji, i am looking for an ma crossover system , based on 4 ma,

buy when 10 ma cross above 20 ma , when 50 ma is above 100 ma
sell when 10 ma cross below 20 ma , when 50 ma is below 100 ma.

pls give me the code for the above , you can also guide me to any trading system which are based on the above concept , that smaller TF ma crossover in the direction of the larger TF trend.
hi

try this

_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorRose, styleCandle | styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 10, 30, 100, 5);
ShortPer = Param("Short Period", 20, 30, 100, 5);
LongMA = MA(C, LongPer);
ShortMA = MA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;

Lengtha = 50;
Pricea = MA(Close, Lengtha);

Lengthb = 100;
Priceb = MA(Close, Lengthb);


Buy = Cross(LongMA, ShortMA) AND Lengtha>Lengthb;
Sell = Cross(ShortMA, LongMA) AND Lengtha<Lengthb;
PlotShapes(shapeUpArrow * Buy, colorBrightGreen, 0, L, - 10);
PlotShapes(shapeDownArrow * Sell, colorRed, 0, H, - 10);
_SECTION_END();
 

pratapvb

Well-Known Member
hi

try this

_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorRose, styleCandle | styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 10, 30, 100, 5);
ShortPer = Param("Short Period", 20, 30, 100, 5);
LongMA = MA(C, LongPer);
ShortMA = MA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;

Lengtha = 50;
Pricea = MA(Close, Lengtha);

Lengthb = 100;
Priceb = MA(Close, Lengthb);


Buy = Cross(LongMA, ShortMA) AND Lengtha>Lengthb;
Sell = Cross(ShortMA, LongMA) AND Lengtha<Lengthb;
PlotShapes(shapeUpArrow * Buy, colorBrightGreen, 0, L, - 10);
PlotShapes(shapeDownArrow * Sell, colorRed, 0, H, - 10);
_SECTION_END();
Buy = Cross(LongMA, ShortMA) AND Lengtha>Lengthb;
Sell = Cross(ShortMA, LongMA) AND Lengtha<Lengthb;

you probably meant pricea > priceb and pricea < priceb

also from requirement pt of view one needs to see if the 10 and 20 cross over happens which the other condition is not met and while 10 and 20 ma is still long...the 50 and 100 cross over happens....is that a long or not?
 
hi

try this

_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", colorRose, styleCandle | styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("EMA CROSSOVER CHART");
LongPer = Param("Long Period", 10, 30, 100, 5);
ShortPer = Param("Short Period", 20, 30, 100, 5);
LongMA = MA(C, LongPer);
ShortMA = MA(C, ShortPer);
LastHigh = HHV(H, LongPer);
GraphXSpace = 10;

Lengtha = 50;
Pricea = MA(Close, Lengtha);

Lengthb = 100;
Priceb = MA(Close, Lengthb);


Buy = Cross(LongMA, ShortMA) AND Lengtha>Lengthb;
Sell = Cross(ShortMA, LongMA) AND Lengtha<Lengthb;
PlotShapes(shapeUpArrow * Buy, colorBrightGreen, 0, L, - 10);
PlotShapes(shapeDownArrow * Sell, colorRed, 0, H, - 10);
_SECTION_END();
Thanks nehal,

As i see it , it only shows shorting trades , is there a problem somewhere.

 

pratapvb

Well-Known Member
Thanks nehal,

As i see it , it only shows shorting trades , is there a problem somewhere.
I already mentioned the possible problem...see my post before yours
 

Similar threads