New intraday trading system

#23
_SECTION_BEGIN("Chart Settings");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer Panel",colorPaleBlue));
SetChartBkGradientFill(ParamColor("Upper Chart",1),ParamColor("Lower Chart",23));
_SECTION_END();

Kisa=Param("KISA GN",12,1,500,1);
Uzun=Param("UZUN GN",43,1,1000,1);
Tetik=Param("TETIK GN",21,1,50,1);

_SECTION_BEGIN("Periodlar");
function KisaPeriodTopla(Kisa )
{
ka=Kisa;
for ( i=1; i<Kisa; i++ )
{
ka=ka+i;
}
return ka;
}


function UzunPeriodTopla( Uzun )
{
au=Uzun;
for ( iu=0; iu<Uzun; iu++ )
{
au=au+iu;
}
return au;
}


function TetikPeriodTopla( Tetik )
{
a=Tetik;
for ( i=0; i<Tetik; i++ )
{
a=a+i;
}
return a;
}

_SECTION_END();

_SECTION_BEGIN(" Gn Toplamlari");
function KisaGunTopla(Kisa)
{
a=Kisa;

kd=a*C;
for(i=0;i<Kisa;i++)
{
b=Ref(C,-i);
if(a>0)
a--;
kd=kd+(a*b);
}
return kd;
}


function UzunGunTopla(Uzun)
{
au=Uzun;
ku=au*C;
for(iu=0;iu<Uzun;iu++)
{
bu=Ref(C,-iu);
if(au>0)
au--;
ku=ku+(au*bu);
}
return ku;
}


Period12Toplam=KisaPeriodTopla(Kisa);
Day12Toplam=KisaGunTopla(Kisa);

LWMA12=Day12Toplam/Period12Toplam;

Period43Toplam=UzunPeriodTopla( Uzun );
Day43Toplam=UzunGunTopla(Uzun);

LWMA43=Day43Toplam/Period43Toplam;

_SECTION_END();


_SECTION_BEGIN(" TSR HESAPLANMASI");

function XDAY(Tetik)
{

X=((2*LWMA12)-LWMA43);
aX=Tetik;
kX=AX*X;
for(iX=0;iX<Tetik;iX++)
{
bX=Ref(X,-iX);
if(aX>0)
aX--;
kX=kX+(aX*bX);
}
return kX;
}

XDayToplam=XDAY(Tetik);
XPeriodToplam=TetikPeriodTopla(Tetik);
TSR=(XDayToplam/XPeriodToplam);
_SECTION_END();

_SECTION_BEGIN(" EKRANA BASMA ISLEMI");

Plot(C,"Kapanis",colorWhite,styleBar);
tsrcolor = IIf(TSR > Ref(TSR,-1),colorLime,colorRed);
Plot(TSR,"TSR",tsrcolor,styleLine|styleThick);

_SECTION_END();


chinmay its for u.
 
#27
Hi friends,

I have one indicator i want to modify these. These is a Awsome indicator Red and Green line histogram. I want buy and sell signal on chart when histogram is green buy signal on chart and when histrogram is red sell signal on chart.

Here i give afl for these indicator. If any one can do pls try these.

_SECTION_BEGIN("Awsome Oscilator");
center=(H+L)/2;
t1=Optimize("t1",34,20,50,3); //slow MA param
t2=Optimize("t2",5,3,10,1); //fast MA param
awi=MA(center,t2)-MA(center,t1);

Plot(awi,"Awsome",IIf(awi>Ref(awi,-1),colorGreen,colorRed),styleHistogram | styleThick);

Buy=Cover=
Cross(awi,0) OR //cross 0
(awi<0 AND awi>Ref(awi,-1) AND Ref(awi, -BarsSince(awi<Ref(awi,-1)))>LLV(awi,BarsSince(awi>0))) OR //lower high built
(awi>0 AND awi>Ref(awi,-1)) // awi direction change to positive above 0 level
;
Short=Sell=
Cross(0,awi) OR //cross 0
(awi>0 AND awi<Ref(awi,-1) AND Ref(awi, -BarsSince(awi>Ref(awi,-1)))<HHV(awi,BarsSince(awi<0))) OR //higher low built
(awi<0 AND awi<Ref(awi,-1)) // awi direction change to negative below 0 level
;

Buy=Cover=ExRem(Buy,Sell);
Sell=Short=ExRem(Short,Cover);
PlotShapes( IIf( Buy, shapeNone , shapeNone ), colorWhite );
PlotShapes( IIf( Short, shapeNone, shapeNone ), colorWhite );
_SECTION_END();


Thanks
 

johnnypareek

Well-Known Member
#29
Hi friends,

I have one indicator i want to modify these. These is a Awsome indicator Red and Green line histogram. I want buy and sell signal on chart when histogram is green buy signal on chart and when histrogram is red sell signal on chart.

Here i give afl for these indicator. If any one can do pls try these.

_SECTION_BEGIN("Awsome Oscilator");
center=(H+L)/2;
t1=Optimize("t1",34,20,50,3); //slow MA param
t2=Optimize("t2",5,3,10,1); //fast MA param
awi=MA(center,t2)-MA(center,t1);

Plot(awi,"Awsome",IIf(awi>Ref(awi,-1),colorGreen,colorRed),styleHistogram | styleThick);

Buy=Cover=
Cross(awi,0) OR //cross 0
(awi<0 AND awi>Ref(awi,-1) AND Ref(awi, -BarsSince(awi<Ref(awi,-1)))>LLV(awi,BarsSince(awi>0))) OR //lower high built
(awi>0 AND awi>Ref(awi,-1)) // awi direction change to positive above 0 level
;
Short=Sell=
Cross(0,awi) OR //cross 0
(awi>0 AND awi<Ref(awi,-1) AND Ref(awi, -BarsSince(awi>Ref(awi,-1)))<HHV(awi,BarsSince(awi<0))) OR //higher low built
(awi<0 AND awi<Ref(awi,-1)) // awi direction change to negative below 0 level
;

Buy=Cover=ExRem(Buy,Sell);
Sell=Short=ExRem(Short,Cover);
PlotShapes( IIf( Buy, shapeNone , shapeNone ), colorWhite );
PlotShapes( IIf( Short, shapeNone, shapeNone ), colorWhite );
_SECTION_END();


Thanks



i have modified sfl. now it shows price m arrow

_SECTION_BEGIN("Awsome Oscilator");
center=(H+L)/2;
t1=Optimize("t1",34,20,50,3); //slow MA param
t2=Optimize("t2",5,3,10,1); //fast MA param
awi=MA(center,t2)-MA(center,t1);

//Plot(awi,"Awsome",IIf(awi>Ref(awi,-1),colorGreen,colorRed),styleHistogram | styleThick);

Buy=Cover=
Cross(awi,0) OR //cross 0
(awi<0 AND awi>Ref(awi,-1) AND Ref(awi, -BarsSince(awi<Ref(awi,-1)))>LLV(awi,BarsSince(awi>0))) OR //lower high built
(awi>0 AND awi>Ref(awi,-1)) // awi direction change to positive above 0 level
;
Short=Sell=
Cross(0,awi) OR //cross 0
(awi>0 AND awi<Ref(awi,-1) AND Ref(awi, -BarsSince(awi>Ref(awi,-1)))<HHV(awi,BarsSince(awi<0))) OR //higher low built
(awi<0 AND awi<Ref(awi,-1)) // awi direction change to negative below 0 level
;

Buy=Cover=ExRem(Buy,Sell);
Sell=Short=ExRem(Short,Cover);
//PlotShapes( IIf( Buy, shapeNone , shapeNone ), colorWhite );
//PlotShapes( IIf( Short, shapeNone, shapeNone ), colorWhite );
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;

Plot( Close, "Price", colorBlack, styleCandle );

PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

GraphXSpace = 5;

_SECTION_END();



johnny
 

hitesh

Active Member
#30
Hi friends ,


I have one afl these indicate two traling stop loss but value of these two traling stop loss is show on X axis but i want to show these value on upper side with open high low colse and two traling stoploss value so i can see back value at any time. Here i give one afl so i you can so pls try.


_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("New formula 5");
// Jim Berg's ATR Trailing Stops
// Ref: Jim Berg - The Truth About Volatility - TASC-2005-Feb
// Ref: http://www.amibroker.com/members/traders/02-2005.html

LongSignal = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) );
ShortSignal = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) );

TrailStopLong = HHV( C - 2 * ATR(10), 15 );
TrailStopShort = LLV( C + 2 * ATR(10), 15 );

Plot(TrailStopLong, "",
IIf(LongSignal AND ShortSignal, colorBlue,
IIf(LongSignal, colorBlue, colorBlue)),
styleLine | styleThick );

Plot(TrailStopShort, "",
IIf(ShortSignal AND LongSignal, colorRed,
IIf(ShortSignal, colorRed, colorRed)),
styleLine | styleThick );

/**** END ****/
_SECTION_END();


Thanks
_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("New formula 5");
// Jim Berg's ATR Trailing Stops
// Ref: Jim Berg - The Truth About Volatility - TASC-2005-Feb
// Ref: http://www.amibroker.com/members/traders/02-2005.html

LongSignal = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) );
ShortSignal = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) );

TrailStopLong = HHV( C - 2 * ATR(10), 15 );
TrailStopShort = LLV( C + 2 * ATR(10), 15 );

Plot(TrailStopLong, "",
IIf(LongSignal AND ShortSignal, colorBlue,
IIf(LongSignal, colorBlue, colorBlue)),
styleLine | styleThick );

Plot(TrailStopShort, "",
IIf(ShortSignal AND LongSignal, colorRed,
IIf(ShortSignal, colorRed, colorRed)),
styleLine | styleThick );

/**** END ****/
_SECTION_END();


///////////// Title //////////////////
Change=C-Ref(C,-1);
ROCVal = ROC(C,1);
Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}" + " O: " + O + ", H:" + H + ", L:" +L+ ", C:"+ C +" ("+NumToStr(Change,1.2)+" )" +" ("+NumToStr(ROCVal,1.2)+" %%)")+EncodeColor(colorBlue)
+EncodeColor(colorBlueGrey) + " Volume: " +NumToStr(V,2)
+ EncodeColor(colorBlue)
+ " TrailStopLong : " +NumToStr(TrailStopLong,1.2) +EncodeColor(colorRed)
+ " TrailStopShort : " +NumToStr(TrailStopShort,1.2 ) ;