I am trying to write BUY/SELL to output text file using below formula.
BUY output is writing repeatedly to text file. Say on current 5 minute
bar buy signal generated. Using LastValue(Buy) function it's writing
buy output text to repeatedly for that current 5 minute candle. It
should write buy signal once not repeatedly. I don't know how to use
StaticVarSet for this purpose. Can anyone help me with following code.
fh = fopen( "1FUTUREBUY.text", "a");
if( LastValue( Buy ))
{
fputs("[1,FUTURE,BUY]", fh );
fclose(fh);
}
else
{
printf("Error opening file");
fclose(fh);
}
fh = fopen( "1FUTURESELL.text", "a");
if( LastValue( Sell))
{
fputs("[1,FUTURE,SELL]", fh );
fclose(fh);
}
else
{
printf("Error opening file");
fclose(fh);
}