Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Time Session Highlight for Amibroker (AFL)
Copy & Paste Friendly
Back
_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();
//////tools 1/////
_SECTION_BEGIN("SESSION TIMING");
TimeFrame= Param("Chart Timeframe (min)",1,1,60,1)*60;
TimeFrameSet(TimeFrame);
TN = TimeNum();
ParamStartTime = ParamTime("Session Start","09:30:00");
ParamEndTime = ParamTime("Session End","15:59:00");
InSessionTime = (TN >= ParamStartTime) AND (TN <= ParamEndTime);
StartOfSession = InSessionTime > Ref(InSessionTime,-1);
EndOfSession = InSessionTime < Ref(InSessionTime,-1);
InsessionTime = InSessionTime OR EndOfSession;
_SECTION_END();
Buy = O < Ref(L,-1) AND InsessionTime;
BuyPrice = O;
Sell = L < Ref(L,-1) OR EndOfSession;
SellPrice = C;
Short = O > Ref(H,-1) AND InsessionTime;
ShortPrice = O;
Cover = H > Ref(H,-1) OR EndOfSession;
CoverPrice = C;
SetTradeDelays(0,0,0,0);
SetOption("CommissionMode",3);
SetOption("CommissionAmount", 0.005);
E=Equity(1);
TradeEquity = ValueWhen(Sell OR Cover,E);
_SECTION_BEGIN("PLOTTING");
Plot(C,"",1,128);
if( ParamToggle("Session Timing Ribbons","HIDE|SHOW",0) )
{
Plot( InSessionTime,"",7,styleArea|styleOwnScale|styleNoLabel,0,60);
Plot( StartOfSession,"",5,styleArea|styleOwnScale|styleNoLabel,0,30);
Plot( EndOfSession,"",4,styleArea|styleOwnScale|styleNoLabel,0,30);
}
OutOfSessionColor = ParamColor("Out of Session",colorDarkRed);
Plot(NOT InSessionTime,"",OutOfSessionColor,styleArea|styleOwnScale|styleNoLabel,0,1);
PlotShapes(IIf(Buy, shapeSmallUpTriangle, shapeNone),5,0,BuyPrice,0);
PlotShapes(IIf(Sell, shapeHollowDownTriangle, shapeNone),4,0,SellPrice,0);
PlotShapes(IIf(Cover, shapeHollowUpTriangle, shapeNone),5,0,CoverPrice,0);
PlotShapes(IIf(Short, shapeSmallDownTriangle, shapeNone),4,0,ShortPrice,0);
if(ParamToggle("Equity curve","HIDE|SHOW",0) )
{
Plot(TradeEquity,"",2,styleStaircase|styleOwnScale);
}
//////tools 2/////
/*
function BlinkText( Text )
{
ABAxisColor = colorWhite;
if( Status("redrawaction") )
{
BlinkState= StaticVarGet("BlinkState");
if( IsNull( BlinkState) ) StaticVarSet("BlinkState", False);
if( BlinkState )
{
Text = EncodeColor(colorBrightGreen)+Text+EncodeColor(ABAxisColor);
StaticVarSet("BlinkState", False);
}
else
{
Text = EncodeColor(ABAxisColor)+Text;
StaticVarSet("BlinkState", True);
}
}
return Text;
}
RequestTimedRefresh( 1 );
DisableSessionTiming = ParamToggle("Auto Session Timing","ENABLED|DISABLED",1);
ParamDateNumber = ParamDate("Date", Now(1), 0);
ParamStartTime = ParamTime("Start","09:30:00");
ParamEndTime = ParamTime("End","15:59:00");
RTTimeNumber = Now(4);
RTDateNumber = Now(3);
InSessionDate = RTDateNumber == ParamDateNumber;
PreSessionTime = RTTimeNumber and ParamStartTime;
PostSessionTime = RTTimeNumber and ParamEndTime;
InSessionTime = NOT ( PreSessionTime OR PostSessionTime );
PrevInSession = StaticVarGet("InSession");
if( DisableSessionTiming ) InSession = 1;
else InSession = InSessionDate AND InSessionTime;
StartSessionTrigger = LastValue(InSession) and PrevInSession;
EndSessionTrigger = LastValue(InSession) and PrevInSession;
StaticVarSet("InSession", InSession);
OutOfSessionColor = ParamColor("Out of Session",colorBlack);
Plot( NOT InSession,"",colorBlack,styleArea|styleOwnScale|styleNoLabel,0,1);
Title = "\n"+BlinkText( Now(0) )+"\n"+
"Session Status: "+
WriteIf( DisableSessionTiming, "Session Timing Disabled",
WriteIf( NOT InSessionDate,"Out of Session date, ","")+
WriteIf(PreSessionTime AND InSessionDate,"Waiting for Start, ","")+
WriteIf(StartSessionTrigger, "Start Trigger, ","")+
WriteIf(InSessionTime, "In Progress, ","")+
WriteIf(EndSessionTrigger, "End Trigger, ","")+
WriteIf(PostSessionTime, "Completed",""));
*/