Use Name() in place of getchartid()
It is missing few signals (2-3 out of 40, of different scrips different signals)
I am unable to find out the reason, running it on 5 mins intraday data.
below is the code:
alreadyopenbuy1 = StaticVarGetText("alreadyopenbuy1"+Name());
alreadyopenbuy2 = StaticVarGetText("alreadyopenbuy2"+Name());
alreadyopensell1 = StaticVarGetText("alreadyopensell1"+Name());
alreadyopensell2 = StaticVarGetText("alreadyopensell2"+Name());
fh = fopen( "C:\\Users\\test\\Desktop\\tradelog.csv", "a" );
if(fh)
{
if ( (LastValue(Buy1) == True ) AND alreadyopenbuy1 == "" )
{
StaticVarSetText("alreadyopenbuy1"+Name() , "1");
StaticVarSetText("alreadyopensell1"+Name() , "");
fputs( now(1) + ","+ now(2) + "," + "BUY1" + " ," + Name() + " ," +Ask+ "\n", fh );
}
if (( LastValue(Buy2) == True ) AND alreadyopenbuy2 == "" )
{
StaticVarSetText("alreadyopenbuy2"+Name() , "1");
StaticVarSetText("alreadyopensell2"+Name() , "");
fputs( now(1) + ","+ now(2) + "," + "BUY2" + " ," + Name() + " ," +Ask+ "\n", fh );
}
if (( LastValue(Sell1) == True ) AND alreadyopensell1 == "" )
{
StaticVarSetText("alreadyopenbuy1"+Name() , "");
StaticVarSetText("alreadyopensell1"+Name() , "1");
fputs( now(1) + ","+ now(2) + "," + "SELL1" + " ," + Name() + " ," +Bid+ "\n", fh );
}
if (( LastValue(Sell2) == True ) AND alreadyopensell2 == "" )
{
StaticVarSetText("alreadyopenbuy2"+Name() , "");
StaticVarSetText("alreadyopensell2"+Name() , "1");
fputs( now(1) + ","+ now(2) + "," + "SELL2" + " ," + Name() + " ," +Bid+ "\n", fh );
}
fclose(fh);
}
else
{
_TRACE("Failed to open the file");
}
Is there anything i should add to the above code???
Please guide.
Thanks.