|
@@ -34,7 +34,7 @@ input double lotSize = 0.1;
|
|
|
//| Expert initialization function |
|
|
//| Expert initialization function |
|
|
|
//+------------------------------------------------------------------+
|
|
//+------------------------------------------------------------------+
|
|
|
// Global Variables
|
|
// Global Variables
|
|
|
-string url1 = "http://myapp.local";///"http://127.0.0.1";
|
|
|
|
|
|
|
+string url1 = "http://127.0.0.1"; // "http://myapp.local";
|
|
|
string header = "Content-Type: application/json\r\nAccept: application/json\r\n";
|
|
string header = "Content-Type: application/json\r\nAccept: application/json\r\n";
|
|
|
|
|
|
|
|
string symbolChart[];
|
|
string symbolChart[];
|
|
@@ -391,20 +391,29 @@ void message(string &result[], string message, int message_id)
|
|
|
if((StringFind(result[i], "sl", 0) != -1))
|
|
if((StringFind(result[i], "sl", 0) != -1))
|
|
|
{
|
|
{
|
|
|
string tempSl[];
|
|
string tempSl[];
|
|
|
|
|
+ StringReplace(result[i],":", " ");
|
|
|
result[i] = trimString(result[i]);
|
|
result[i] = trimString(result[i]);
|
|
|
|
|
+ result[i] = spaceRemove(result[i]);
|
|
|
//Print(" Sl String: ", result[i]);
|
|
//Print(" Sl String: ", result[i]);
|
|
|
- StringSplit(result[i], ':', tempSl);
|
|
|
|
|
|
|
+ StringSplit(result[i], ' ', tempSl);
|
|
|
if(ArraySize(tempSl) >= 2)
|
|
if(ArraySize(tempSl) >= 2)
|
|
|
sl = (double) tempSl[1];
|
|
sl = (double) tempSl[1];
|
|
|
Print("Sl : ", sl);
|
|
Print("Sl : ", sl);
|
|
|
}
|
|
}
|
|
|
if((StringFind(result[i], "tp", 0) != -1))
|
|
if((StringFind(result[i], "tp", 0) != -1))
|
|
|
{
|
|
{
|
|
|
- // Print("Tp : ", result[i], " index is: ", i);
|
|
|
|
|
|
|
+ Print("Tp : ", result[i], " index is: ", i);
|
|
|
string tempTp[];
|
|
string tempTp[];
|
|
|
|
|
+ StringReplace(result[i],":", " ");
|
|
|
result[i] = trimString(result[i]);
|
|
result[i] = trimString(result[i]);
|
|
|
- StringSplit(result[i], ':', tempTp);
|
|
|
|
|
|
|
+ result[i] = spaceRemove(result[i]);
|
|
|
|
|
+ Print("Tp After String Replace : ", result[i], " index is: ", i);
|
|
|
|
|
+ StringSplit(result[i], ' ', tempTp);
|
|
|
//double tp = (double) tempTp[1];
|
|
//double tp = (double) tempTp[1];
|
|
|
|
|
+ for(int j=0 ; j < ArraySize(tempTp); j++)
|
|
|
|
|
+ {
|
|
|
|
|
+ Print(" Data is: ", tempTp[j]);
|
|
|
|
|
+ }
|
|
|
if(ArraySize(tempTp) >= 2)
|
|
if(ArraySize(tempTp) >= 2)
|
|
|
tp = (double) tempTp[1];
|
|
tp = (double) tempTp[1];
|
|
|
Print("Tp : ", tp);
|
|
Print("Tp : ", tp);
|
|
@@ -491,19 +500,53 @@ void addtoMessageStructure(int message_id,string message)
|
|
|
string trimString(string inputt)
|
|
string trimString(string inputt)
|
|
|
{
|
|
{
|
|
|
// Remove spaces from the left and right sides
|
|
// Remove spaces from the left and right sides
|
|
|
- int start = 0;
|
|
|
|
|
|
|
+ int startt = 0;
|
|
|
int end = StringLen(inputt) - 1;
|
|
int end = StringLen(inputt) - 1;
|
|
|
|
|
|
|
|
// Find the first non-space character
|
|
// Find the first non-space character
|
|
|
- while(start <= end && StringGetCharacter(inputt, start) == ' ')
|
|
|
|
|
- start++;
|
|
|
|
|
|
|
+ while(startt <= end && StringGetCharacter(inputt, startt) == ' ')
|
|
|
|
|
+ startt++;
|
|
|
|
|
|
|
|
// Find the last non-space character
|
|
// Find the last non-space character
|
|
|
- while(end >= start && StringGetCharacter(inputt, end) == ' ')
|
|
|
|
|
|
|
+ while(end >= startt && StringGetCharacter(inputt, end) == ' ')
|
|
|
end--;
|
|
end--;
|
|
|
|
|
|
|
|
// Extract the substring without leading or trailing spaces
|
|
// Extract the substring without leading or trailing spaces
|
|
|
- return StringSubstr(inputt, start, end - start + 1);
|
|
|
|
|
|
|
+ return StringSubstr(inputt, startt, end - startt + 1);
|
|
|
|
|
+ }
|
|
|
|
|
+//+------------------------------------------------------------------+
|
|
|
|
|
+//| |
|
|
|
|
|
+//+------------------------------------------------------------------+
|
|
|
|
|
+string spaceRemove(string inputt)
|
|
|
|
|
+ {
|
|
|
|
|
+ int len = StringLen(inputt);
|
|
|
|
|
+ string out = "";
|
|
|
|
|
+ bool inSpace = false;
|
|
|
|
|
+
|
|
|
|
|
+ for(int i = 0; i < len; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ ushort ch = StringGetCharacter(inputt, i);
|
|
|
|
|
+ // treat space, tab, CR, LF as whitespace
|
|
|
|
|
+ bool isSpace = (ch == 32 || ch == 9 || ch == 10 || ch == 13);
|
|
|
|
|
+
|
|
|
|
|
+ if(isSpace)
|
|
|
|
|
+ {
|
|
|
|
|
+ // mark that we are inside a whitespace run, but don't append yet
|
|
|
|
|
+ inSpace = true;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // when we hit a non-space after whitespace, add a single space (if out not empty)
|
|
|
|
|
+ if(inSpace && StringLen(out) > 0)
|
|
|
|
|
+ out += " ";
|
|
|
|
|
+
|
|
|
|
|
+ // append the non-space character (use substr to preserve unicode chars)
|
|
|
|
|
+ out += StringSubstr(inputt, i, 1);
|
|
|
|
|
+
|
|
|
|
|
+ inSpace = false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return(out);
|
|
|
}
|
|
}
|
|
|
//+------------------------------------------------------------------+
|
|
//+------------------------------------------------------------------+
|
|
|
//| |
|
|
//| |
|