- Renaming or commenting an order line, TP or SL Line
- Comment() Text Color
- Comments in Backtest
I've come up with this to check comments, unfortunately this is failing to initiate orders.
I needed a way to track any changes in the comment so if the comments don't match the change is written to a text file which is checked each time. The comment will ALWAYS start with a BUY or a SELL so I am looking for BUY or SELL in the comment string. I am also looking for any change in the comment string. Please have a look at this and let me know where I'm messing up. There are no errors in compile and no errors when dropped on a chart except "....uninit reason 0". I have checked and verified that it works when the CheckComment function in removed.
int CheckComment(string checkComment)
{string fbciComment=ObjectDescription("EURUSDm_SFBInd_FractalComment2");
int handle;
string pComment;
handle=FileOpen("eutrade.txt", FILE_READ);
if(handle>0)
{
pComment=FileReadString(handle);
FileClose(handle);
}
if(fbciComment != pComment)
{
int index=StringFind(fbciComment, checkComment, 0);
if(index!=-1)
{
return (index);
handle=FileOpen("eutrade.txt", FILE_WRITE);
if(handle<1)
{
Print("can't open file error-",GetLastError());
return(0);
}
FileWriteString(handle,fbciComment,38);
FileClose(handle);
}
else
{
return (0);
}
}
else
{
return (0);
}
}
int start()
{
//----
if (GetOrdersCount() == 0)
{
if (CheckComment("BUY") > 0)
{
fbuy();
}
if (CheckComment("SELL") > 0)
{
fsell();
}
}
return(0);
}

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use