Scripts: Balance Graph HTML - page 2

To add comments, please log in or register
fxsaber
15703
fxsaber  
amrali:

This might be shorter and faster

Yes, it is shorter. But has no possibility of further modification. For example, if you need to get graphs of profits, commissions, turnover, etc.


#define OP_BALANCE 6
#define OP_CREDIT  7
amrali
1794
amrali  
fxsaber, can I use the animated gif from your post
fxsaber
15703
fxsaber  
amrali:
fxsaber, can I use the animated gif from your post

Of course!

fxsaber
15703
fxsaber  
amrali:

Where can I generate various variants of the Graph.txt file?


<script src="exdat.txt" type="text/javascript"></script>

How to include data from exdat.txt file in final html file?

fxsaber
15703
fxsaber  

This method does not work. Therefore, I wrote a universal converter.


void ChangeString( string &Str )
{
  StringReplace(Str, "\\", "\\\\");
  StringReplace(Str, "\"", "\\\"");
  
  Str = "\"" + Str + "\\r\\n\" + " + "\n";
  
  return;
}

bool TextFileToMQH( const string FileNameIn, const string FileNameOut )
{
  const int handleIn = FileOpen(FileNameIn, FILE_READ | FILE_TXT | FILE_ANSI);
  bool Res = (handleIn != INVALID_HANDLE);

  if (Res)  
  {
    const int handleOut = FileOpen(FileNameOut, FILE_WRITE | FILE_TXT | FILE_ANSI);
    
    if (Res = (handleOut != INVALID_HANDLE))
    {
      FileWriteString(handleOut, "string StrMQH = \n");
      
      while (!FileIsEnding(handleIn))
      {
        string Str = FileReadString(handleIn);
  
        ChangeString(Str);
        FileWriteString(handleOut, Str);
      }

      FileWriteString(handleOut, "NULL;\n");
  
      FileClose(handleOut);            
    }
    
    FileClose(handleIn);
  }
  
  return(Res);
}

void OnStart()
{
  TextFileToMQH("Graph.txt", "Graph.mqh");
}


Now you can include the file in the source code

#include <..\Files\Graph.mqh>
fxsaber
15703
fxsaber  
amrali:

I pasted your HTML code into my library.

amrali
1794
amrali  
fxsaber:

I pasted your HTML code into my library.

No problem 
amrali
1794
amrali  
fxsaber:
Excellent work 
12
To add comments, please log in or register