Vwap first 15 minute candle high/low cross over scan error

I didn't get any scan results and back test result with the following VWAP first 15 minute candle HIGH/LOW cross over code,please help

_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();

_SECTION_BEGIN("VWAP");
/*
The VWAP for a stock is calculated by adding the dollars traded for every
transaction in that stock ("price" x "number of shares traded") and dividing the total shares traded. A VWAP is computed from the Open of the market to the market Close, AND is calculated by Volume weighting all transactions during this time period
*/

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 090000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today  ) / TodayVolume,0);
Plot (VWAP,"VWAP",colorBlue, styleDashed ,styleThick);
_SECTION_END();


FBL=ValueWhen(Day()!=Ref(Day(),-1),L);
FBH=ValueWhen(Day()!=Ref(Day(),-1),H);
Plot( FBH, "", colorGreen, styleLine );
Plot( FBL, "", colorRed, styleLine );

Buy = Cross(VWAP,FBH);
Sell = Cross(FBL,VWAP); 

PlotShapes(shapeSmallUpTriangle*Buy,colorWhite);
PlotShapes(shapeSmallDownTriangle*Sell,colorYellow);

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Filter=Buy;
AddColumn(Buy ,"BUY",1.0);
Filter=Sell;
AddColumn(Sell ,"SELL",1.0);

 


1 Like

Remove ALL LINES containing

_SECTION_BEGIN
_SECTION_END

And try again

I have not examined all of your code, but @RAZMEN55 your Filter settings are just overriding each other.

Filter=Buy;
AddColumn(Buy ,"BUY",1.0);
Filter=Sell;
AddColumn(Sell ,"SELL",1.0);

That is senseless. Your final setting is only going to show "Sell" signals, so change the above to

Filter = Buy OR Sell;

i tried,but not working

i changed code as per ur opinion but it is not working

Define not working

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() ); 


/*
The VWAP for a stock is calculated by adding the dollars traded for every
transaction in that stock ("price" x "number of shares traded") and dividing the total shares traded. A VWAP is computed from the Open of the market to the market Close, AND is calculated by Volume weighting all transactions during this time period
*/

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 090000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today  ) / TodayVolume,0);
Plot (VWAP,"VWAP",colorBlue, styleDashed ,styleThick);


FBL=ValueWhen(Day()!=Ref(Day(),-1),L);
FBH=ValueWhen(Day()!=Ref(Day(),-1),H);
Plot( FBH, "", colorGreen, styleLine );
Plot( FBL, "", colorRed, styleLine );

Buy = Cross(VWAP,FBH);
Sell = Cross(FBL,VWAP); 

PlotShapes(shapeSmallUpTriangle*Buy,colorWhite);
PlotShapes(shapeSmallDownTriangle*Sell,colorYellow);

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

AddColumn(Buy ,"BUY",1.0);
AddColumn(Sell ,"SELL",1.0);

Filter=BUY OR Sell;

1 Like

Capture

In Analysis settings which periodicity you set ?

Haven’t tried your code but looking at your line with Iff() function you haven’t assigned a variable to it.

Condition1= iif()...

You should compare if and iff functions.

Aswell your sell variable references VWAP which is only defined in your iif() function so if it’s not true your sell function is looking for a cross of 0.

You should define vwap outside any if or iif().

i changes periodicity to 15 minute now i am getting scan results its working...thanks but i only get 1 scan result for this month actually 5 or more cross over happened this monthCapture

all problems solved its now working fine...thanks for support