Simple Coding Help - No Promise.

_SECTION_BEGIN("Value Trader");
_N(Title = StrFormat("{{NAME}}-{{INTERVAL}} {{DATE}} Open %g, High %g, Low %g, {{VALUES}} • © ValueTechnicals.com", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
ValProUp56(H,L,C,V);
AlertIf( Sell, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
SetChartBkColor(ParamColor("Outer Panel",colorBlack));
SetChartBkGradientFill(ParamColor("Upper Chart",colorDarkTeal),ParamColor("Lower Chart",colorBlack));
ValPro1(O);
AlertIf( Sell, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone), colorGreen, 0, Low, Offset=-15);
PlotShapes(IIf(Buy,shapeSmallCircle,shapeNone), colorGreen, 0, Low, Offset=-28);
PlotShapes(IIf(Sell, shapeDownArrow,shapeNone), colorRed, 0, High, Offset=-15);
PlotShapes(IIf(Sell, shapeSmallCircle,shapeNone), colorRed, 0, High, Offset= 28);
SetChartOptions(0,chartShowArrows|chartShowDates);
AlertIf( Sell, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
YH = TimeFrameGetPrice("H", inDaily, -1);
YL = TimeFrameGetPrice("L", inDaily, -1);
YC = TimeFrameGetPrice("C", inDaily, -1);
YO = TimeFrameGetPrice("O", inDaily);
myama = AMA(AMA_VAL(O,H,L,C),0.5);
mywma = WMA(WMA_VAL(O,H,L,C,myama),10);
NW = Trail1(O,H,L,C,myama,mywma);
j = Trail2(O,H,L,C,myama,mywma);
Trail11 = IIf( NW < j, NW, Null );
Trail22 = IIf( NW > j, NW, Null );
Plot( IIf( NW < j, NW, Null ), "Trail-Long", colorGreen, styleStaircase | styleThick | styleNoTitle);
Plot( IIf( NW > j, NW, Null ), "Trail-Short", colorRed, styleStaircase | styleThick | styleNoTitle);
PP = Get_pp(YH,YC,YL);
R1 = Get_r1(PP,YL,YL);
R2 = Get_r2(PP,YH,YL);
R3 = Get_r3(YH,PP,YL);
S1 = Get_s1(PP,YH);
S2 = Get_s2(PP,YH,YL);
S3 = Get_s3(YL,YH,PP);
O1 = Get_val(O);
H1 = Get_val(H);
L1 = Get_val(L);
C1 = Get_val(C);
GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorLightBlue, 3 );
GfxSetBkMode( colorWhite );
GfxSelectSolidBrush( colorBlack );
GfxRoundRect( 5, 286, 102, 20, 0, 0 );
GfxSelectFont( "Arial", 10, 900, False );
GfxSetTextAlign(0);
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(R1, "T1: "+(R1),""), 17, 130);
GfxTextOut( WriteIf(R2, "T2: "+(R2),""), 17, 115);
GfxTextOut( WriteIf(R3, "T3: "+(R3),""), 17, 100);
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf(YH, "MID: "+(PP),""), 17, 145);
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(S1, "T1: "+(S1),""), 17, 160);
GfxTextOut( WriteIf(S2, "T2: "+(S2),""), 17, 175);
GfxTextOut( WriteIf(S3, "T3: "+(S3),""), 17, 190);
GfxSetTextColor( colorGold );
GfxTextOut( WriteIf(C1, "Cl: "+(C1),""), 17, 70);
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(L1, "Lo: "+(L1),""), 17, 55);
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(H1, "Hi: "+(H1),""), 17, 40);
GfxSetTextColor( colorGold );
GfxTextOut( WriteIf(O1, "Op: "+(O1),""), 17, 25);
GfxSetTextColor( colorLightBlue );
GfxRoundRect( 5, 94, 102, 93, 0, 0 );
GfxRoundRect( 5, 213, 102, 214, 0, 0 );
GfxRoundRect( 5, 258, 102, 259, 0, 0 );
GfxSetTextColor( colorLime );
GfxTextOut("TL: "+Trail11,17,220);
GfxSetTextColor( colorRed );
GfxTextOut("TS: "+Trail22,17,235);
GfxSetTextColor( colorGold );
GfxTextOut( ("ValueRT.com"),11,264);
_SECTION_END();


sir plese correct this afl
 
pl corrcet this afl


_SECTION_BEGIN("Value Trader");
_N(Title = StrFormat("{{NAME}}-{{INTERVAL}} {{DATE}} Open %g, High %g, Low %g, {{VALUES}} • © ValueTechnicals.com", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
ValProUp56(H,L,C,V);
AlertIf( Sell, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
SetChartBkColor(ParamColor("Outer Panel",colorBlack));
SetChartBkGradientFill(ParamColor("Upper Chart",colorDarkTeal),ParamColor("Lower Chart",colorBlack));
ValPro1(O);
AlertIf( Sell, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone), colorGreen, 0, Low, Offset=-15);
PlotShapes(IIf(Buy,shapeSmallCircle,shapeNone), colorGreen, 0, Low, Offset=-28);
PlotShapes(IIf(Sell, shapeDownArrow,shapeNone), colorRed, 0, High, Offset=-15);
PlotShapes(IIf(Sell, shapeSmallCircle,shapeNone), colorRed, 0, High, Offset= 28);
SetChartOptions(0,chartShowArrows|chartShowDates);
AlertIf( Sell, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
AlertIf( Buy, "SOUND C:\\ValueTrader\\alert1.wav", "Audio alert", 2 );
YH = TimeFrameGetPrice("H", inDaily, -1);
YL = TimeFrameGetPrice("L", inDaily, -1);
YC = TimeFrameGetPrice("C", inDaily, -1);
YO = TimeFrameGetPrice("O", inDaily);
myama = AMA(AMA_VAL(O,H,L,C),0.5);
mywma = WMA(WMA_VAL(O,H,L,C,myama),10);
NW = Trail1(O,H,L,C,myama,mywma);
j = Trail2(O,H,L,C,myama,mywma);
Trail11 = IIf( NW < j, NW, Null );
Trail22 = IIf( NW > j, NW, Null );
Plot( IIf( NW < j, NW, Null ), "Trail-Long", colorGreen, styleStaircase | styleThick | styleNoTitle);
Plot( IIf( NW > j, NW, Null ), "Trail-Short", colorRed, styleStaircase | styleThick | styleNoTitle);
PP = Get_pp(YH,YC,YL);
R1 = Get_r1(PP,YL,YL);
R2 = Get_r2(PP,YH,YL);
R3 = Get_r3(YH,PP,YL);
S1 = Get_s1(PP,YH);
S2 = Get_s2(PP,YH,YL);
S3 = Get_s3(YL,YH,PP);
O1 = Get_val(O);
H1 = Get_val(H);
L1 = Get_val(L);
C1 = Get_val(C);
GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorLightBlue, 3 );
GfxSetBkMode( colorWhite );
GfxSelectSolidBrush( colorBlack );
GfxRoundRect( 5, 286, 102, 20, 0, 0 );
GfxSelectFont( "Arial", 10, 900, False );
GfxSetTextAlign(0);
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(R1, "T1: "+(R1),""), 17, 130);
GfxTextOut( WriteIf(R2, "T2: "+(R2),""), 17, 115);
GfxTextOut( WriteIf(R3, "T3: "+(R3),""), 17, 100);
GfxSetTextColor( colorWhite );
GfxTextOut( WriteIf(YH, "MID: "+(PP),""), 17, 145);
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(S1, "T1: "+(S1),""), 17, 160);
GfxTextOut( WriteIf(S2, "T2: "+(S2),""), 17, 175);
GfxTextOut( WriteIf(S3, "T3: "+(S3),""), 17, 190);
GfxSetTextColor( colorGold );
GfxTextOut( WriteIf(C1, "Cl: "+(C1),""), 17, 70);
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(L1, "Lo: "+(L1),""), 17, 55);
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(H1, "Hi: "+(H1),""), 17, 40);
GfxSetTextColor( colorGold );
GfxTextOut( WriteIf(O1, "Op: "+(O1),""), 17, 25);
GfxSetTextColor( colorLightBlue );
GfxRoundRect( 5, 94, 102, 93, 0, 0 );
GfxRoundRect( 5, 213, 102, 214, 0, 0 );
GfxRoundRect( 5, 258, 102, 259, 0, 0 );
GfxSetTextColor( colorLime );
GfxTextOut("TL: "+Trail11,17,220);
GfxSetTextColor( colorRed );
GfxTextOut("TS: "+Trail22,17,235);
GfxSetTextColor( colorGold );
GfxTextOut( ("ValueRT.com"),11,264);
_SECTION_END();
 
Hi Mastermind,

I am a new to automated trading and i was wondering if you can help me. I have read in one of your old post that you are building such a system and it will be good if we can chat/talk on it.. please mail me at ramanbagga2002 at yahoo.com on how you would like me to communicate with you.

Thanks,
Raman
 

Nehal_s143

Well-Known Member
Hi

I am trying to use Smooth RSI 13 of 10 min on 5 min chart with following afl

_SECTION_BEGIN("RSI");
//Plot (EMA (RSI(13),5), "SmoothRSI", colorRed);

RSIS=EMA (RSI(13),5);

mycRSI=IIf(RSIS>50,colorBlue,
IIf(RSIS<50,colorRed,31));

//Plot(6, "", mycRSI, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
_SECTION_END();

_SECTION_BEGIN("RSI 10min");
tf=Param("Time Frame (min)",10,1,10,1);tfrm=in1Minute*tf;
TimeFrameSet(tfrm);

RSIS=EMA (RSI(13),5);
fty=50;

TimeFrameRestore();

RSIS2=EMA (RSI(13),5);
fty2=50;

RSIS2f = TimeFrameExpand( RSIS2, tfrm);
fty2f = TimeFrameExpand( fty2, tfrm);


mycRSI2=IIf(RSIS2f>fty2f,colorBlue,
IIf(RSIS2f<fty2f,colorRed,31));

Plot(6, "ribbon", mycRSI2, styleOwnScale| styleArea|styleNoLabel,-0.5,100);

_SECTION_END();

When i shift to 10 min chart ribbon plotting is correct but when i come back to 5 min ribbon is wrong, same can be seen in image

5min chart


10 min chart




please help to plot ribbon correctly on 5 min chart

Idea is to take buy on 5 min chart only if 10 min Smooth RSI is above 50 and vise verse
 

pratapvb

Well-Known Member
Hi

I am trying to use Smooth RSI 13 of 10 min on 5 min chart with following afl

_SECTION_BEGIN("RSI");
//Plot (EMA (RSI(13),5), "SmoothRSI", colorRed);

RSIS=EMA (RSI(13),5);

mycRSI=IIf(RSIS>50,colorBlue,
IIf(RSIS<50,colorRed,31));

//Plot(6, "", mycRSI, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
_SECTION_END();

_SECTION_BEGIN("RSI 10min");
tf=Param("Time Frame (min)",10,1,10,1);tfrm=in1Minute*tf;
TimeFrameSet(tfrm);

RSIS=EMA (RSI(13),5);
fty=50;

TimeFrameRestore();

RSIS2=EMA (RSI(13),5);
fty2=50;

RSIS2f = TimeFrameExpand( RSIS2, tfrm);
fty2f = TimeFrameExpand( fty2, tfrm);


mycRSI2=IIf(RSIS2f>fty2f,colorBlue,
IIf(RSIS2f<fty2f,colorRed,31));

Plot(6, "ribbon", mycRSI2, styleOwnScale| styleArea|styleNoLabel,-0.5,100);

_SECTION_END();

When i shift to 10 min chart ribbon plotting is correct but when i come back to 5 min ribbon is wrong, same can be seen in image

5min chart


10 min chart




please help to plot ribbon correctly on 5 min chart

Idea is to take buy on 5 min chart only if 10 min Smooth RSI is above 50 and vise verse
Put the if condition and color setting into the timeframeset region, then expand that and then use that color
 

Nehal_s143

Well-Known Member
Thank you pratapvb sir for kind help, now color ribbon in 5 min is showing proper color, also thanks to happy singh sir for starting great thread, beginner like me we will able to learn from other quires
 
Last edited:

Nehal_s143

Well-Known Member
hi

I am using hourly pivot for finding intraday trend using below afl

If price close below upper range and above lower range then color is yellow in ribbon IIf(C<HPPU AND C>HPPL,colorYellow,31))); at some places (not at all places) color is coming yellow and some places color is coming blue instead of yellow

please see image marked 3 lines ribbon should show yellow instead of blue




please help me to correct the error/code




_SECTION_BEGIN("PriceCandle");
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", colorPink ), styleNoTitle | styleCandle|styleNoLabel );
_SECTION_END();


_SECTION_BEGIN("Hourly Levels");
//////////////////////////////////HOURLY /////////////////////////////////
HH= TimeFrameGetPrice( "H", inHourly, -1) ;
HL= TimeFrameGetPrice( "L", inHourly, -1) ;
HC= TimeFrameGetPrice( "C", inHourly, -1) ;


HPP = (HH + HL + HC)/3;



// PARAMETERS
SHALD = ParamList("HOURLY Pivots", "selected only|all|hide" );

//day
PDP = ParamList("HPP", "SHOW|HIDE" );

HPP2 = (HH + HL)/2;

HPPU = HPP+(HPP-HPP2);
HPPL = HPP-(HPP-HPP2);

// PLOTS
style = IIf(ParamList("Chart style", "styleCandle|styleBar")=="styleCandle",64,128);
//Plot (C,Date ()+" close",11,style);
//day
if ((PDP=="SHOW" OR SHALD=="all") && SHALD!="hide")

Plot (Hpp,"HOURLY Pivot",colorGold,1);PlotText( "HPP : "+Hpp+"", BarCount+3, LastValue(Hpp), colorLime,1);
Plot(HPPU, "",colorGold,styleDashed);
Plot(HPPL, "",colorGold,styleDashed);
//PlotOHLC(PPL,PPU,PPL,PPU,"",colorSkyblue,styleCloud | styleNoLabel);


_SECTION_END();

myc=IIf(C>HPPU,colorBlue,
IIf(C<HPPL,colorRed,//31));
IIf(C<HPPU AND C>HPPL,colorYellow,31)));

Plot(6, "", myC, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
 
Hello Friends

I am starting this thread for helping anyone who requires small changes in AFLs or AFL coding done for small / simple requirements that can be clearly defined.

What does not go is conversion . . . from Amibroker to anything else . . . or from anything else to Amibroker . . .

Debugging requested for copy/paste AFLs, Please don't post huge AFLs with zillions of lines of code for debugging

I will not be available for any conversions and I am not interested in debugging some-one else's copy/pasted work and lastly . . .
Not interested in hacking/craking any ones work . . .

Only if have a clearly definable task to be coded I maybe able to help . . . No Promises but will try within my limitations . . .


As an example, recently one of our friends wanted a motivational message to be included in his Charts,
I enjoyed doing that, as i could easily empathize with why he wanted that . . .


Cheers

:) Happy
How to compare candle in loop with a particular variable say X & Y and replace the value of variable if variable is higher/lower than candle high/low
for (i=1, i<barcount, i++)
{
X= iif(x<H, H, X)
Y= iiif(x<L, L, Y)
}
 

Similar threads