Can somebody help fix the problm in this afl

#1
Hi afl experts

A friend gave m this afl.
i find it doesnt plot the breakout lines.it plots just price candles.

can somebody fix th problm-make plot breakout lines please!
regards
ford
=============================
HTML:
_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("Open Range Break Out");
//Determine the value of the market open. Initial setting is for
//9:30 AM to match US Market Open. Adjust as need for your market
MrktOpen = ValueWhen(TimeNum() == 091500, Open);
//Determine the highest high for each day's trading.
//Adjust time as needed for your market.
DlyHigh = HighestSince(TimeNum() == 091500, High);
//Take a snapshot value of the day's high at the time of market 
//close. Intial setting is 4:00 pm to match US Market Close. 
//Adjust as needed for your market.
DlyHighest = ValueWhen(TimeNum() == 160000, DlyHigh);
//Do the same for the lowest value of the trading day.
//Adjust time as needed for your market.
DlyLow = LowestSince(TimeNum() == 091500, Low);
DlyLowest = ValueWhen(TimeNum() == 160000, DlyLow);
//Now calculate the min range value using Open, Low and High
//variables calculated above
RngMin = Min(DlyHighest - MrktOpen, MrktOpen - DlyLowest);
//Compres this to a daily time frame in order to capture
//the final value of the Range Min for each trading day
DlyRngMin = TimeFrameCompress(RngMin, inDaily, compressLast);
//Use the compressed variable to calculate a 10 day average
RngMinAvg = MA(DlyRngMin , 10);
//uncompress the daily variable so that it can be used in 
//calcuating the long and short break out levels for each day
RngMinAvg = TimeFrameExpand(RngMinAvg, inDaily);

//Use the values calculated above to determine the opening
//range break outs. Notice the Range Min has been shifted so
//that is reads the previous day's value and this is used against
//the current day's open to determine the break out levels
BreakOutLong = MrktOpen + Ref(RngMinAvg, -1);
BreakOutShort = MrktOpen - Ref(RngMinAvg, -1);

//Set parameter default to NO for diplaying values which
//are used to determine core metrics
PlotOHL = ParamToggle("Plot O,H,L", "YES|NO", 1);
//Set parameter default to YES for displaying the final
//results of the break out calculations.
PlotBreak =  ParamToggle("Plot Breakout", "YES|NO", 0);


//Plot values per the parameter toggle settings.
if(PlotOHL == 0)
{
Plot(MrktOpen, "Daily Open", colorBlack, styleLine);
Plot(DlyHigh , "Daily High", colorGreen, styleDashed);
Plot(DlyLow , "Daily Low", colorRed, styleDashed);
Plot(DlyHighest , "Daily Highest", colorGreen, styleDots);
Plot(DlyLowest , "Daily Lowest", colorRed, styleDots);
}
if(PlotBreak == 0)
{
Plot(MrktOpen, "Daily Open", colorBlack, styleLine);
Plot(BreakOutLong , "Break Out Long", colorGreen, styleLine);
Plot(BreakOutShort , "Break Out Short", colorRed, styleLine);
}
_SECTION_END();
 

johnnypareek

Well-Known Member
#3
Hi afl experts

A friend gave m this afl.
i find it doesnt plot the breakout lines.it plots just price candles.

can somebody fix th problm-make plot breakout lines please!
regards
ford
=============================
HTML:
_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("Open Range Break Out");
//Determine the value of the market open. Initial setting is for
//9:30 AM to match US Market Open. Adjust as need for your market
MrktOpen = ValueWhen(TimeNum() == 091500, Open);
//Determine the highest high for each day's trading.
//Adjust time as needed for your market.
DlyHigh = HighestSince(TimeNum() == 091500, High);
//Take a snapshot value of the day's high at the time of market 
//close. Intial setting is 4:00 pm to match US Market Close. 
//Adjust as needed for your market.
DlyHighest = ValueWhen(TimeNum() == 160000, DlyHigh);
//Do the same for the lowest value of the trading day.
//Adjust time as needed for your market.
DlyLow = LowestSince(TimeNum() == 091500, Low);
DlyLowest = ValueWhen(TimeNum() == 160000, DlyLow);
//Now calculate the min range value using Open, Low and High
//variables calculated above
RngMin = Min(DlyHighest - MrktOpen, MrktOpen - DlyLowest);
//Compres this to a daily time frame in order to capture
//the final value of the Range Min for each trading day
DlyRngMin = TimeFrameCompress(RngMin, inDaily, compressLast);
//Use the compressed variable to calculate a 10 day average
RngMinAvg = MA(DlyRngMin , 10);
//uncompress the daily variable so that it can be used in 
//calcuating the long and short break out levels for each day
RngMinAvg = TimeFrameExpand(RngMinAvg, inDaily);

//Use the values calculated above to determine the opening
//range break outs. Notice the Range Min has been shifted so
//that is reads the previous day's value and this is used against
//the current day's open to determine the break out levels
BreakOutLong = MrktOpen + Ref(RngMinAvg, -1);
BreakOutShort = MrktOpen - Ref(RngMinAvg, -1);

//Set parameter default to NO for diplaying values which
//are used to determine core metrics
PlotOHL = ParamToggle("Plot O,H,L", "YES|NO", 1);
//Set parameter default to YES for displaying the final
//results of the break out calculations.
PlotBreak =  ParamToggle("Plot Breakout", "YES|NO", 0);


//Plot values per the parameter toggle settings.
if(PlotOHL == 0)
{
Plot(MrktOpen, "Daily Open", colorBlack, styleLine);
Plot(DlyHigh , "Daily High", colorGreen, styleDashed);
Plot(DlyLow , "Daily Low", colorRed, styleDashed);
Plot(DlyHighest , "Daily Highest", colorGreen, styleDots);
Plot(DlyLowest , "Daily Lowest", colorRed, styleDots);
}
if(PlotBreak == 0)
{
Plot(MrktOpen, "Daily Open", colorBlack, styleLine);
Plot(BreakOutLong , "Break Out Long", colorGreen, styleLine);
Plot(BreakOutShort , "Break Out Short", colorRed, styleLine);
}
_SECTION_END();

I guess this is opening range breakout system.

try this. u can edit time in afl as per ur need

HTML:
_SECTION_BEGIN("Opening range");
breakoutime = 101500;
afterbreakout0 = Cross(TimeNum(),101500);
afterbreakout1 = TimeNum()>=101500;
NewDay = Day()!= Ref(Day(), -1);
highestoftheday = HighestSince(newday,H,1);
Lowestoftheday =LowestSince(newday,L,1);
ORBHigh = ValueWhen(afterbreakout0,highestoftheday,1);
ORBLow = ValueWhen(afterbreakout0,lowestoftheday,1);
Buy= Cross(C,orbhigh) AND afterbreakout1;
Sell = Cross(orblow,C) AND afterbreakout1;
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

Short=Cross(C,ORblow) AND afterbreakout1;
Cover=Cross(ORbhigh,C) AND afterbreakout1;

Plot(C,"",colorBlack,styleBar);
PlotShapes( shapeUpArrow * Buy, colorGreen,0,L,-12);
PlotShapes( shapeDownArrow * Sell, colorRed,0,H,-12);
Plot(afterbreakout0,"",colorBlue,styleHistogram|styleOwnScale);
Plot(ORBHigh,"",colorGreen,styleDots);
Plot(ORBLow,"",colorRed,styleDots);
_SECTION_END();

_SECTION_BEGIN("TSKPDynSupRes");
sw = E_TSKPSWINGLINE(High,Low,Close);
// tskp_sw, tskp_swmean,tskp_swupper,tskp_swlower
Plot( tskp_swmean, "Mean", ParamColor( "MeanColor", colorDarkGreen ), ParamStyle("MeanStyle",styleNoLabel) ); 
Plot( tskp_swupper, "Resistance", ParamColor( "ResistanceColor", colorDarkGreen ), ParamStyle("ResistanceStyle",styleNoLabel) ); 
Plot( tskp_swlower, "Support", ParamColor( "SupportColor", colorDarkGreen ), ParamStyle("SupportStyle",styleNoLabel) ); 
_SECTION_END();
 

johnnypareek

Well-Known Member
#4
another one

HTML:
function ParamOptimize( pname, defaultval, minv, maxv, step )
{
return Optimize( pname,
Param( pname, defaultval, minv, maxv, step ),
minv, maxv, step );
}




_SECTION_BEGIN("Augubhai's ORB System v1.1"); 

//--Intraday time frame 
TimeFrameSet(in5Minute); //If reseting, check formula for TimeFrameInMinutes 
TimeFrameInMinutes = 5;

//--Define all params 
EntryBufferPct = ParamOptimize("Entry Buffer %", 0, 0, 2, 0.1);
SLPct = ParamOptimize("SL %", 1.4, 0.1, 10, 0.1);
TargetPct = ParamOptimize("Target %", 0, 0, 20, 0.5);
MaxTarget = 100;
TargetPct = IIf(TargetPct == 0, MaxTarget, TargetPct); 
EntryTimeStart = ParamOptimize("Entry Time Start (Minutes)", 5, 5, 120, 5);
EntryBarStart = floor(EntryTimeStart/TimeFrameInMinutes) - 1;
EntryTimeEnd = ParamOptimize("Entry Time End (Minutes)", 25, 10, 180, 5);
EntryBarEnd = floor(EntryTimeEnd/TimeFrameInMinutes) - 1;
EntryBarEnd = IIf(EntryBarEnd < EntryBarStart, EntryBarStart, EntryBarEnd);  

//--Plot Price Candle Chart
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", colorBlack, styleNoTitle | GetPriceStyle() ); 

//--New Day & Time. End Day & Time . End Day & Time is null till end of day 1  
NewDay = (Day()!= Ref(Day(), -1)) OR BarIndex() == 0; 
printf("\n NewDay  : " + NewDay ); 
EndDay = (Day()!= Ref(Day(), 1)); 
printf("\n EndDay  : " + EndDay );
FirstBarTime = ValueWhen(NewDay,TimeNum(),1); 
EndTime = ValueWhen(EndDay,TimeNum(),1);
SquareOffTime = EndTime;

//--Calculate ORB, and SL
HighestOfDay = HighestSince(NewDay,H,1); 
LowestOfDay = LowestSince(NewDay,L,1); 
BarsSinceNewDay = BarsSince(NewDay);
ORBH = ValueWhen(BarsSinceNewDay<=EntryBarStart,HighestOfDay ,1) * (1 + (EntryBufferPct/100)); 
ORBL = ValueWhen(BarsSinceNewDay<=EntryBarStart,LowestOfDay ,1) * (1 - (EntryBufferPct/100)); 
ORBHSL = ORBH * (1-(SLPct/100)); 
//ORBHSL = ORBL; 
ORBLSL = ORBL * (1+(SLPct/100));
//ORBLSL = ORBH; 
ORBHTarget = ORBH * (1+(TargetPct/100));
ORBLTarget = ORBL * (1-(TargetPct/100));

//--Find Buy, Sell, Short & Cover Signals
BuySignal = (H >= ORBH) AND (BarsSinceNewDay  > EntryBarStart); 
printf("\nBuySignal : " + BuySignal ); 
ShortSignal = (L <= ORBL) AND (BarsSinceNewDay  > EntryBarStart) ; 
printf("\nShortSignal  : " + ShortSignal ); 
BarsSinceLastBuySignal = (BarsSince(Ref(BuySignal,-1)) + 1);
BarsSinceLastShortSignal = (BarsSince(Ref(ShortSignal,-1)) + 1);
BarsSinceLastEntrySignal = Min(BarsSinceLastBuySignal, BarsSinceLastShortSignal);
BothEntrySignalsNull = IsNull(BarsSinceLastBuySignal) AND IsNull(BarsSinceLastShortSignal); //true for start of Day 1
printf("\n\nBarsSinceNewDay : " + BarsSinceNewDay ); 
printf("\n BarsSinceLastEntrySignal : " + BarsSinceLastEntrySignal); 
Buy = (H >= ORBH) AND (BarsSinceNewDay  > EntryBarStart) AND (BarsSinceNewDay <= EntryBarEnd) AND ((BarsSinceNewDay < BarsSinceLastEntrySignal) OR BothEntrySignalsNull ); 
Sell = (L <= ORBHSL) OR (H >= ORBHTarget) OR (TimeNum() > SquareOffTime-1) AND (BarsSinceNewDay > BarsSinceLastBuySignal); 
Short = (L <= ORBL) AND (BarsSinceNewDay  > EntryBarStart) AND (BarsSinceNewDay <= EntryBarEnd) AND ((BarsSinceNewDay < BarsSinceLastEntrySignal) OR BothEntrySignalsNull ); 
Cover = (H >= ORBLSL) OR (L <= ORBLTarget) OR (TimeNum() > SquareOffTime-1) AND (BarsSinceNewDay > BarsSinceLastShortSignal); 
printf("\nBuy : " + Buy ); 
printf("\nSell : " + Sell ); 
printf("\nShort : " + Short ); 
printf("\nCover : " + Cover ); 

//--Handle if ORB broken both sides on same bar
//--And remove duplicate Sell & Cover signals, since ExRem did not work as needed when Buy & Sell on same bar
orbBothSides = IIf(Buy AND Short, 1, 0); 
Buy = IIf(orbBothSides AND C <= O, 0, Buy); 
Short = IIf(orbBothSides AND C > O, 0, Short); 
Sell = IIf(orbBothSides AND C > O AND (L <= ORBHSL), 1, Sell); 
Sell = IIf((BarsSince(Buy) < (BarsSince(Ref(Sell,-1))+1)) OR (BarsSince(Buy) AND IsNull(BarsSince(Ref(Sell,-1)))),Sell,0);
Cover = IIf(orbBothSides AND C <= O AND (H >= ORBLSL), 1, Cover); 
Cover = IIf((BarsSince(Short) < (BarsSince(Ref(Cover,-1))+1)) OR (BarsSince(Short) AND IsNull(BarsSince(Ref(Cover,-1)))),Cover,0);
printf("\n\norbBothSides : " + orbBothSides); 
printf("\nBuy : " + Buy ); 
printf("\nSell : " + Sell ); 
printf("\nShort : " + Short ); 
printf("\nCover : " + Cover ); 

//--Special Condition for 18 & 19 May 2009 for the Indian Market
Buy =IIf(DateNum()==1090518 OR (DateNum()==1090519 AND NewDay),0,Buy );
Sell =IIf(DateNum()==1090518 OR (DateNum()==1090519 AND NewDay),0,Sell );
Short =IIf(DateNum()==1090518 OR (DateNum()==1090519 AND NewDay),0,Short );
Cover =IIf(DateNum()==1090518 OR (DateNum()==1090519 AND NewDay),0,Cover );

//--Set prices
BuyPrice = IIf(Buy, ORBH, Null); 
SellPrice = IIf(Sell, IIf(H >= ORBHTarget, ORBHTarget, Max(ORBHSL, L)), Null); 
ShortPrice = IIf(Short, ORBL, Null); 
CoverPrice = IIf(Cover, IIf(L <= ORBLTarget, ORBLTarget, Min(ORBLSL, H)), Null); 

//--Plot ORB, and SL 
Plot(ORBHSL,"",colorRed,styleDashed); 
Plot(ORBLSL,"",colorRed,styleDashed); 
Plot(IIf(TargetPct == MaxTarget, Null, ORBHTarget),"",colorGreen,styleDashed);
Plot(IIf(TargetPct == MaxTarget, Null, ORBLTarget),"",colorGreen,styleDashed);
PlotOHLC( ORBL, ORBH, ORBL, ORBH, "", colorYellow, styleCloud); 
 
//--Plot Signals
shape1 = Buy * shapeUpArrow + Sell * shapeDownArrow; 
PlotShapes( shape1, IIf( Buy, colorGreen, colorGreen), 0, IIf( Buy, Low, High ) ); 
shape2 = Cover * shapeUpArrow + Short * shapeDownArrow; 
PlotShapes( shape2, IIf( Cover, colorRed, colorRed), 0, IIf( Cover, Low, High ) ); 
GraphXSpace = 5; 

//--Restore time frame 
TimeFrameRestore(); 
_SECTION_END();
 

johnnypareek

Well-Known Member
#5
U can backtest it.

HTML:
_SECTION_BEGIN("Backtestable ORB");
SetBarsRequired(100000,0);
GraphXSpace = 15;
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
GfxSetBkMode(0); 
GfxSetOverlayMode(1);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Market_Start_Time=091500;
Market_Open_Brakeout=111500; 
Market_end_time=151500; 
 
//need to consider 60 min insted of 100 //Market_Signal_time=Market_end_time - Market_Open_Brakeout;
Market_Signal_time=033000;
Min_in_signal_time=2190;                

Bars_in_Signal=210/5;
Total_No_Of_Every_Day_Bar=72;


target_point=Optimize("target_point",150,20,200,1);
SetPositionSize(1,spsShares);

//Total_No_Of_Every_Day_Bar=(Market_end_time-Market_Start_Time)/5(Time in Min)
printf("\n Bars in the signal is =>" + Bars_in_Signal);
//(for 5 Min Chart divide by 5 AND for 15 Min Charts divide by 15 (Min))
printf("\n market singal Time=>"+Market_Signal_time);
SetTradeDelays(1,1,1,1);
ST=MArket_start_time=091500;
BT=brake_out_time=111500; 
Currtime =TimeNum(); 
Currentdate=DateNum(); 
afterbreakout0 = Cross(TimeNum(),BT); 
printf("\n Todays date is +" +NumToStr((Currentdate),formatDateTime )); 
Curren_Dae=Day(); 
SetPositionSize(1,spsShares);   
 
//--New Day & Time. End Day & Time . End Day & Time is null till end of day 1 
  //IT will check the condition of the each bar .
NewDay = Day()!= Ref(Day(), -1); 
printf("\n Day+starttime  : " + Day() ); 
EndDay = (Day()!= Ref(Day(), 1)); 

printf("\n newday Value is=>"+NewDay);
printf("\n End day value is =>"+EndDay); 




printf("\n EndDay  : " + EndDay ); 
starttime = Cross(TimeNum(),ST);
TimeNum()>ST; 
//it will caluclate the highest and lowest array from the start time 
//.its go on calculating entire array till next Day 
 Exit_Time = TimeNum() > Market_end_time; 

Highest_science = HighestSince(starttime,H,1); 
Lowest_science =LowestSince(starttime,L,1); 
 
WriteIf (IsNan(Highest_science) , "higest_scinece value is = 
"+Highest_science+"  ","")+"\n"+ 
 
 
//it will calculate the high and low value of the BT time 
 
ORBH = ValueWhen(afterbreakout0,Highest_science,1); 
ORBL = ValueWhen(afterbreakout0,Lowest_science,1); 
 
 
//Plots ORB High and Low Line 
Plot(ORBH,"",colorGreen,styleDots); 
Plot(ORBL,"",colorBlue,styleDots); 
Buy=IIf(Cross(C,ORBH) AND (Currtime>BT) ,True,Null); 
Short =IIf((Cross(ORBL,C) AND (Currtime>BT)) ,True,Null); 
Shortflag=-99;
BarsToday = 1 + BarsSince( Day() != Ref(Day(), -1));
Buy_Bar_count=ValueWhen(Buy,BarsToday,1);
Short_bar_Count=ValueWhen(Short,BarsToday,1);

printf("\n Buy signal coming at the bar => "+Buy_Bar_count);

printf ("\n Today's date is =>"+ Date()); 
printf ("Bar is =>"+BarsToday); 


ReminingBarinDay=ReminingBarinDay_short=60;

Buy=ExRemSpan(Buy,ReminingBarinDay);
Short=ExRemSpan(Short,ReminingBarinDay_short) ;

//this is for when buy is active and short signal is coming
sellflag_short=IIf(Short==1,   True,0);
//Shortflag=Buyflag=IIf(NewDay == 1 ,2,Null);

//this is for when short is active and Buy signal is coming

Coverflag_buy=IIf(Buy==1,True,0);

// to set the flag when buy condition is true

 IIf(Buy==1,Buyflag=1,0);

BuyPrice1=ValueWhen(Buy,C,1);
SellPrice1=BuyPrice1+target_point; 

printf("\n before sell signal coming SellPrice:-" +SellPrice1);
Sell_Cond=Cross(H,SellPrice1);
//Sell_Cond=IIf(H >=SellPrice1,True,False);
printf("\n DD->Sell  Cond Value is =>"+Sell_Cond);

//short flag is used to close the condition when buy condition is active at the same time short is also active (in short when the buy signal is active short signal is coming so closing the position of buy @short price);

printf("\n Buy flag value is =>"+BuyFlag);
printf("\n Sell_flag_short value is =>"+Sellflag_short);


//Shortflag=Close the existing position when Short Signal arrived
//End Day:-close the open position at the end of the day 
    Sell=IIf(((BuyFlag==1) AND  ((Sell_Cond==1) OR (EndDay==1))),True ,Null);

//this is for when buy is active and short signal is coming
       Sell=IIf(((BuyFlag==1) AND (Sellflag_short==1 ) ),True ,Sell);






Shortflag=Buyflag=IIf(NewDay == 1  ,2,Null);

Sell=ExRem(Sell,Buy);



printf("\n Buy Verible value is =>"+Buy);
printf("\n Sell Verible value is =>"+Sell);

SellPrice=ValueWhen(Sell,H,1);
printf("\n  sellsell price is :-" +SellPrice); 

ShortPrice=ValueWhen(Short,C,1); 

//Setting the flag when short condition is active

 IIf(Short==1,Shortflag=1,0);
 
printf("Short flag value is =>"+Shortflag);

printf("\n short sell flag value is =>" +Sellflag_short);

ShortPrice1=ValueWhen(Short,C,1);

//Cover the Condition Of the Lower point

CoverPrice1=ShortPrice1-target_point;

printf ("Short price is for price1 is =>"+ ShortPrice1);
printf ("CoverPrice is for price1 is =>"+ CoverPrice1);
 
Cover_cond= IIf(L<=CoverPrice1,True,False); 
printf("\n Cover Cond Value is =>"+Cover_Cond);

//Cover the position when Short is active AND Current price(L) is Less then Condition price OR Close the position end Of the Day  

Cover=IIf((ShortFlag==1) AND (Cover_Cond==1 OR EndDay==1),True,Null) ;

//this is for covering the position when buy signal is appering when short signal is active .clsoing the existing short position

Cover=IIf((ShortFlag==1) AND (Coverflag_buy==1),True,Cover);

printf("\n Cover value is =>"+Cover);

CoverPrice=ValueWhen(Cover,C,1);

printf("\n Cover price is ->"+CoverPrice);

Cover=ExRem(Cover,Short);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20); 
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=20); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30); 
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25); 
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorGreen, 0, H, Offset=-20); 
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorBlue , 0, L, Offset=-20);
 

Similar threads