Dear friends and respected seniors,
My afl generates many signals before completion of the candle(repainting), so i used static variables , but its not working I know i am making some mistake, but I am not able to find it
this is the code that i m using
This code appends the generated signals to a .txt file, but for a 15 min candle i m getting 15 signals
the value of static variable BuyVar is always null, I tried to set its value with StaticVarSet and StaticVarSetText, but still it remains null ( dont know y )
these r the contents of that .txt file
Can anyone please kindly guide me and point out my mistake
Awaiting your replies,
Thank you.
My afl generates many signals before completion of the candle(repainting), so i used static variables , but its not working I know i am making some mistake, but I am not able to find it
this is the code that i m using
Code:
_SECTION_BEGIN("Price100");
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() );
Buy=Cross(MACD(), Signal());
PlotShapes(Buy*shapeUpArrow,colorWhite,0,L,-12);
DT = LastValue(DateNum());
TT = LastValue(TimeNum());
BuyVar = StaticVarGetText(Name() +"-Buy");
BuyVar1 = Name()+"-Buy-"+NumToStr(DT,1)+"-"+NumToStr(TT,1)+"-"+NumToStr(GetChartID(),1);
BuyL = LastValue(Buy);
if ( BuyL AND BuyVar != BuyVar1)
{
Filepath = "C:/buy_signal.txt";
fh = fopen( Filepath, "a");
if (fh)
fputs(BuyVar + "\n" + BuyVar1 + "\n",fh);
fclose( fh );
}
_SECTION_END();
the value of static variable BuyVar is always null, I tried to set its value with StaticVarSet and StaticVarSetText, but still it remains null ( dont know y )
these r the contents of that .txt file
Code:
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
NIFTY-Buy-1,171,103-103,000-1,045
Awaiting your replies,
Thank you.
Last edited: