My visual effect afl collection.

yasu222

Active Member
#71
Date number and tine number

EXAMPLE:
1. if you want to know the BarIndex() value at a given date:

Index = ValueWhen( DateNum()== Date_To_Num("10012004") ,
BarIndex(), 1);

2. if you want to know the Close price at a given time:

Date_Value = DateNum() == Date_To_Num("10012004");//ddmmyyyy
Time_Value = TimeNum() == Time_To_Num("094500"); // or ("155900"),hhmmss
valueWhen( Date_Value And Time_Value, C,1);

3. if you want to know the High value at a given date:

Hdt = ValueWhen( DateNum()== Date_To_Num("10012004") ,
H, 1);

These syntax may be useful for Gann time cycle.
 
#72
Can you please post more details on studies on Gann Time Cycle and an afl for the same, if one is there (with chart if possible)
Thanks
 

yasu222

Active Member
#73
Can you please post more details on studies on Gann Time Cycle and an afl for the same, if one is there (with chart if possible)
Thanks
Yes sir,

It is in the developing stage...

Nature has seasons like winter,summer,monsoon etc, like that each and every script has its own season on every month/year..sometimes not...

Tsunamis, Tornados, cyclones etc., are like nature disasters.. same way

different scripts has its own disaster days...

So, I am planning to co-relate the both nature and market in coming days...
 

yasu222

Active Member
#74
Average True Range Trailing Stops

PHP:
// get start date  
Start = Cross( DateNum(), ParamDate("Start date", "2015-05-25" ) );  
Started = Flip( Start, 0 );  
 
StopMode = ParamList("Stop Mode", "Fixed|Chandelier|Modified ATR" );  
StopLevel = Param("Fixed perc %", 14, 0.1, 50, 0.1)/100;  
StopATRFactor = Param("ATR multiple", 4, 0.5, 10, 0.1 );  
StopATRPeriod = Param("ATR period", 14, 3, 50 );  
 
// calculate support and resistance levels  
if( StopMode == "Fixed" ) // fixed percent trailing stop  
{  
 sup = C * ( 1 - stoplevel );  
 res = C * ( 1 + stoplevel );  
}  
else // Chandelier ATR-based stop  
if( StopMode == "Chandelier" )  
{  
 sup = C - StopATRFactor * ATR( StopATRPeriod );  
 res = C + StopATRFactor * ATR( StopATRPeriod );  
}  
else  
{  
 HL = H - L;  
 MAHL =  1.5 * MA( HL, StopATRPeriod );  
 HiLo = IIf( HL < MAHL, HL, MAHL );  
 H1 = Ref( H, -1 );  
 L1 = Ref( L, -1 );  
 C1 = Ref( C, -1 );  
 Href = IIf( L <= H1, H - C1, ( H - C1 ) - ( L - H1 ) / 2 );  
 Lref = IIf( H >= L1, C1 - L, ( C1 - L ) - ( L1 - H ) / 2 );  
 
 diff1 = Max( HiLo, HRef );  
 diff2 = Max( diff1, LRef );  
 
 ATRmod = Wilders( diff2, StopATRPeriod );  
    
 sup = C - StopATRFactor * ATRmod ;  
 res = C + StopATRFactor * ATRmod ;  
}  
 
// calculate trailing stop line  
trailARRAY = Null;  
trailstop = 0;  
for( i = 1; i < BarCount; i++ )  
{  
 if( Started[ i ] == 0 ) continue;  
 
 if( C[ i ] > trailstop AND C[ i - 1 ] > trailstop )  
   trailstop = Max( trailstop, sup[ i ] );  
 else  
 if( C[ i ] < trailstop AND C[ i - 1 ] < trailstop )  
    trailstop = Min( trailstop, res[ i ] );  
 else  
   trailstop = IIf( C[ i ] > trailstop, sup[ i ], res[ i ] );        
 
 trailARRAY[ i ] = trailstop;  
}  
 
// generate buy/sell signals based on crossover with trail stop line  
Buy = Start OR Cross( C, trailArray );  
Sell = Cross( trailArray, C );  
 
PlotShapes(Buy*shapeUpArrow,colorGreen,0,trailarray);  
PlotShapes(Sell*shapeDownArrow,colorRed,0,trailarray);  
 
Plot( Close,"Price",colorBlack,styleBar);  
//SetBarFillColor( colorYellow );  
Plot( trailARRAY,"trailing stop level", colorRed, styleLine );
 
#75
Yes sir,

It is in the developing stage...

Nature has seasons like winter,summer,monsoon etc, like that each and every script has its own season on every month/year..sometimes not...

Tsunamis, Tornados, cyclones etc., are like nature disasters.. same way

different scripts has its own disaster days...

So, I am planning to co-relate the both nature and market in coming days...
Nice explanation. :)

BTW, I will be comfortable if you call me kaalchakrasamay or just kcs, (if you feel kaalchakrasamay, a bit long :lol:)
and not sir etc.
 

yasu222

Active Member
#76
WhatsUp_SYS

PHP:
_SECTION_BEGIN("WhatsUp_Sys");
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() ); 
SetBarsRequired( 100000, 100000); 
desiredHigh = ValueWhen(DateNum() == 1150605, High);
Buy1 = Cross (Close, desiredHigh); 
Sell1= Cross(desiredHigh, Close);
Buy=ExRem(Buy1,Sell1);
Sell=ExRem(Sell1,Buy1);
Short=Sell;
Cover=Buy;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
Plot(desiredHigh, "desiredHigh", colorRed, styleLine, Null, Null, 10 );

_SECTION_END();
 
Last edited:

yasu222

Active Member
#77
Fb_sys

PHP:
_SECTION_BEGIN("FB_Sys");
//FLASH_BACK_SYS
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() ); 
SetBarsRequired( 100000, 100000); 
desiredLow = ValueWhen(DateNum() == 1150605, Low);
Buy1 = Cross (Close, desiredLow); 
Sell1= Cross(desiredLow, Close);
Buy=ExRem(Buy1,Sell1);
Sell=ExRem(Sell1,Buy1);
Short=Sell;
Cover=Buy;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
Plot(desiredHigh, "desiredLow", colorRed, styleLine, Null, Null, 10 );

_SECTION_END();
 
Last edited:

yasu222

Active Member
#78
Show Dates and Hide Quote Marker automatically.

Show dates and Hide quote marker automatically by adding these lines at beginning of the AFL. Wrap the text too.

PHP:
SetBarsRequired( 100000, 100000);
SetChartOptions(2, chartWrapTitle );
SetChartOptions( 2, chartHideQuoteMarker );
SetChartOptions( 2, chartShowDates );

or

SetChartOptions(2, chartWrapTitle|chartHideQuoteMarker|chartShowDates );
 
Last edited:

ayush2020

Well-Known Member
#79
Re: Show Dates and Hide Quote Marker automatically.

hii can you plz add some screen shots with each AFL??

Show dates and Hide quote marker automatically by adding these lines at beginning of the AFL. Wrap the text too.

PHP:
SetBarsRequired( 100000, 100000);
SetChartOptions(2, chartWrapTitle );
SetChartOptions( 2, chartHideQuoteMarker );
SetChartOptions( 2, chartShowDates );

or

SetChartOptions(2, chartWrapTitle|chartHideQuoteMarker|chartShowDates );
 

yasu222

Active Member
#80
Metastock RAVI_SWING formula

PHP:
no:=Input("Swing/ Bars",1, 400, 2); 
res:=HHV(H,no);
sup:=LLV(L,no);
HLd:=If(CLOSE>Ref(res,-1),
{then}1,
{else}If(CLOSE<Ref(sup,-1),
{then}-1,
{else}0));
HLv:=ValueWhen(1,HLd<>0,HLd);
HiLo:=If(HLv=-1,
{then}res,
{else}sup);
HiLo;
 

Similar threads