Simple Coding Help - No Promise.

amitrandive

Well-Known Member
I need simple code..please help

When MA rising green color and when MA falling color red..I tried but I cannot write the code..Thank you for help
Code:
_SECTION_BEGIN("Price1");
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("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 5, 2, 200, 1, 10 );
// Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );

Plot(EMA( P, Periods ), _DEFAULT_NAME(),
IIf(EMA( P, Periods ) > Ref(EMA( P, Periods ),-1),ParamColor("Rising EMA", colorBlue),ParamColor("Falling EMA", colorRed)));

_SECTION_END();
 
Code:
_SECTION_BEGIN("Price1");
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("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 5, 2, 200, 1, 10 );
// Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );

Plot(EMA( P, Periods ), _DEFAULT_NAME(),
IIf(EMA( P, Periods ) > Ref(EMA( P, Periods ),-1),ParamColor("Rising EMA", colorBlue),ParamColor("Falling EMA", colorRed)));

_SECTION_END();

Thank you my friend
 

Nehal_s143

Well-Known Member
hi

in below code i want to remove Param option for CY1, CY, M1 & M2

please help

_SECTION_BEGIN("");
CY1 = Param("Short Cycle Length?" ,10, 1 ,1000 ,1 )/2;
CY2 = Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2;
M1 = Param("Short Cycle Multiplyer?" ,1, 0.01 ,10 ,1 );
M2 = Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 );
T1 = Ref(MA(Close ,CY1 ),-CY1/2)+ M1*ATR(CY1 );
B1 = Ref(MA( Close ,CY1 ),-CY1/2)- M1*ATR(CY1 );

if (ParamToggle("No or Yes","NONE|YES",1))
{
Plot(T1, "", colorLime);
Plot(B1, "", colorLime);
}
_SECTION_END();
 

pratapvb

Well-Known Member
hi

in below code i want to remove Param option for CY1, CY, M1 & M2

please help

_SECTION_BEGIN("");
CY1 = Param("Short Cycle Length?" ,10, 1 ,1000 ,1 )/2;
CY2 = Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2;
M1 = Param("Short Cycle Multiplyer?" ,1, 0.01 ,10 ,1 );
M2 = Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 );
T1 = Ref(MA(Close ,CY1 ),-CY1/2)+ M1*ATR(CY1 );
B1 = Ref(MA( Close ,CY1 ),-CY1/2)- M1*ATR(CY1 );

if (ParamToggle("No or Yes","NONE|YES",1))
{
Plot(T1, "", colorLime);
Plot(B1, "", colorLime);
}
_SECTION_END();
just remove param an replace by absolute deault values

CY1 = 10 ; // Param("Short Cycle Length?" ,10, 1 ,1000 ,1 )/2;
CY2 = 80 ; // Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2;
M1 = 1 ; // Param("Short Cycle Multiplyer?" ,1, 0.01 ,10 ,1 );
M2 = 3 ; // Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 );
 
ok. i will do. may be i wud hv missed sumthing. thks!
but wen i copy pasted mentioned code and comiple, i got many syntax errors.
Just realize that language used in that is not AFL. It is VBScript and needs to be run from Windows. There are ways to embed it into AFL but this seemed to be easier approach at the time.
 

KelvinHand

Well-Known Member
Just realize that language used in that is not AFL. It is VBScript and needs to be run from Windows. There are ways to embed it into AFL but this seemed to be easier approach at the time.
Are you sure you write that code in VBScript !!!:D

007 must associate with J......................................................................................................................................................................Script.
 
Last edited:

xsis

Active Member
nw realised tht it ws in other language only. i was scratching my head tht i cudn decode it. felt so dumb tht cudn ask again to help me :lol:

anywys thks :thumb:

Just realize that language used in that is not AFL. It is VBScript and needs to be run from Windows. There are ways to embed it into AFL but this seemed to be easier approach at the time.
 

dell

Well-Known Member
senior's ,how we can put conditions like if previous two trades are failed (loss ) than initiate new trade ? like , yesterday trade get in loss , now today trade also in loss than tommorow signal will be taken , if both of earlier trades are not in loss than not take new signal ........
just trying to see if this filter is working or not ? will this type of filters works in long run ?
 
Hi,

I wanted small help from veteran members. I want to Scan Daily Top 20 Gainers and Losers from Specific Group or Watchlist in Amibroker. I have created a watchlist for CNX Nifty 500 stocks and want to know on daily basis top 20 gainers and loser stocks.

from wisetrader site i found following code, but it is not working out. I am not good at coding, so seek your help.

//////////////////////////////////////////////////////////
_SECTION_BEGIN("IntradaySuRe");
pchng = (C - Ref(C,-1)) /( Ref(C,-1) * 100);
pchng=ROC(C,1);
Filter = pchng;
AddColumn(Close, "Close Price",1);
AddColumn(pchng, "Percent Change",1 ,textcolor=IIf( Ref(C,- 1)>C,colorRed,colorGreen));
_SECTION_END();

Also if possible, please do the programming in such a way that Top 20 Gainers and Losers can be generated for Weekly also.

This would be of great help.. and Thanks in advance. :thumb:
 

Similar threads