My question lacks certainly knowledge, but unfortunately I didn't find
any documentation about it.
I have the following code which works as wanted except at the end,
as it writes all the values in the file and not only the values just
before the switch of the signal. This code is joint to a strategy
which generates alternatively long- and shortsignals.
filepath = "C:\\ScanExport.txt";
fdelete( filepath );
fh = fopen( filepath, "a", True );
qs = "";
if ( fh )
{
dt = DateTime();
fputs( Name() + "," , fh );
fputs( "DT,sig,entry,stop,prof,loss\n", fh );
for ( i = 0; i < BarCount; i++ )
{
fputs( DateTimeToStr( dt[ i ] ) + ",", fh );
qs = StrFormat( "%g,%g,%g,%g,%g\n", Ref(lastsignal[ i ],-1), Ref(entry[ i ],-1), Ref(realstopprice[ i ],-1) , PrecRound(Ref( bestprofit[ i ],-1), roundl ),PrecRound( Ref(worstloss[ i ],-1), roundl));
addtxtcond = LastSignal[ i ] != Ref(LastSignal[ i ],-1);
IIf(addtxtcond,fputs( qs, fh ),null);
}
fclose( fh );
So the addtxtcond doesn't seem to work, as the file is filled with
all the data and not only those before the change of the signal occurs.
Thank you for your attention