Simple Coding Help - No Promise.

kumudhan

Well-Known Member
Screenshot_2.png

thank you@bbhanusali ji. now comes a dumb request from me...i dont even know if i asked understandable to you...thank you in advance..
 
Last edited:
View attachment 33809
thank you@bbhanusali ji. now comes a dumb request from me...i dont even know if i asked understandable to you...thank you in advance..
@kumudhan: You got me stumped, even I don't know how to do that. I have tried the attached code but it is giving wrong results. Hope, some seniors chip in, to correct me.

Code:
EquityFNODuration = 152959-91559;
CommodityDuration = 112959-90059;
TradeSegment = Paramlist("Trade Segment","EquityFNO|Commodity",0);
MarketDuration = IIf(TradeSegment == "EquityFNO",EquityFNODuration,CommodityDuration);
Period = MarketDuration/Interval();


LC = LLV(C, -Period);
HC = HHV(C, -Period);

Plot(  cdl(LC) , "", colorblue, styledashed  + styleNoLabel );
Plot(  cdl(HC) , "", colorbluegrey, styleline  + styleNoLabel);

Edit:  Even "CommodityDuration = 232959-90059" is giving the wrong result.
 
Last edited:
Any 1 have AnchoredVWAP coding PLS MAKE AFL

study("Anchored VWAP",overlay=true)
Year = input(2017, minval = 1, maxval = 2099, type=integer, title='Year')
Month = input(10, minval = 1, maxval = 12, type=integer, title='Month')
Day = input(10, minval = 1, maxval = 31, type=integer, title='Day')
Hour = input(12, minval = 0, maxval = 23, type=integer, title='Hour')
Minute = input(0, minval = 0, maxval = 59, type=integer, title='Minute')
DebugMode = input(false, type=bool, title='Debug Mode')
start = security(tickerid, '1', time)
impulse_func = iff(timestamp(Year,Month,Day,Hour,Minute) == time, 1, 0)
newSession = iff(change(start), 1, 0)
startSession = newSession * impulse_func
vwapsum = iff(startSession, ohlc4*volume, vwapsum[1]+ohlc4*volume)
volumesum = iff(startSession, volume, volumesum[1]+volume)
myvwap = vwapsum/volumesum
plot(myvwap, linewidth=3, transp=0, title='AVWAP')
plot(DebugMode ? hour : na)
plot(DebugMode ? minute : na)




https://www.tradingview.com/script/...E0OEZvvNYit1zwVY2HOIhjo9lAwc9wpwzAzOBDIiggnFE
 
Last edited:
_SECTION_BEGIN("Grid_HourDay");
ShowGrid = ParamToggle("Show Grid", "No|Yes", 1);
if (ShowGrid == 1)
{
grid_DAY = IIf(Day() != Ref(Day(), -1), 1, 0);
grid_DAY_color = ParamColor("СolorDAY", colorBlue);
Plot(grid_DAY, "", grid_DAY_color, styleHistogram|styleThick|styleNoLabel|styleNoRescale|styleOwnScale);

grid_HOUR = IIf(Hour() != Ref(Hour(), -1), 1, 0);
grid_HOUR_color = ParamColor("СolorHOUR", colorBrown);
Plot(grid_HOUR, "", grid_HOUR_color, styleHistogram|styleDashed|styleNoLabel|styleNoRescale|styleOwnScale);
}
else
{}
_SECTION_END();
Please help, if the use the above code to plot grid lines on each hour, the grid lines are plotted ate 10:00 ,11:00 etc instead of 10;15,11:15 and so on.. Please guide
 
How can I check if the current candle's volume is greater than moving average of last 20 candles volume or not ?
I need to check it by looping and not by array form.
Please help me.

I tried to use this code but it is giving an error. This is just portion of the code and its giving error in IF condition

for(i = 1;i < BarCount; i++)
{
if(Volume > 3* ma(volume,20)

I am not getting any errors if I check this code for errors. But when I scan the code for finding real stocks I am getting error that - condition in IF statement has to be numeric or Boolean type. You can not use array here.

After this error, just to check I changed the code to if(Volume > 100000) and then its working perfectly fine.
Kindly assist me what changes I need to make if I want to find candles which has volume greater than 3 times of moving average of of last 20 candles volume.
 

ethan hunt

Well-Known Member
AFL problem:

In Scanner:

Once a BUY is triggered an AFL is giving BUY on every candle till SELL is triggered.
Vice-versa for SELL.

In Charts: Using ExRim avoids multiple BUY/SELL Arrows so it is working fine.

Backtesting is working fine, after BUY comes SELL, after SHORT comes COVER. No multiple BUY or SELL entries.

What to do to set the Scanner right ?
 

Similar threads