Coding help - page 701

 
AtApi:

Hi guys and code gurus, 

i`m looking for a simple indicator that plots its own values from a CSV file. Can someone please help me?

 

 

Thanks in advance! 

What does the "its own value" mean?
 
mladen:
What does the "its own value" mean?

Thanks mladen,

let`me explain a bit better: i need an indicator that read from a CVS file and plot the values in a sub-window, the CVS will have 2 values comma separated, the first value is the date and the second is the actually value that the indicator should plot. 

for example

the CVS look like this:

date,value
2016.10.26.05.55,126.845
2016.10.26.05.50,126.848
2016.10.26.05.45,126.844
2016.10.26.05.40,126.82
2016.10.26.05.35,126.816
2016.10.26.05.30,126.81

 the indicator will plot the value accordingly to the date

i hope its a bit more clear now..

 

Thanks for your help friend! 

 

Dear Friend,

 

i need to coding,

candle close then if candle is UP then alert UP and candle is DOWN then alert DOWN any time frame

 

if you have pls share me, 

thank you in adance,

 - jesing 

 
AtApi:

Thanks mladen,

let`me explain a bit better: i need an indicator that read from a CVS file and plot the values in a sub-window, the CVS will have 2 values comma separated, the first value is the date and the second is the actually value that the indicator should plot. 

for example

the CVS look like this:

Time,value 

2016.10.26.21.20,127.765

2016.10.26.21.15,127.777

2016.10.26.21.10,127.777

2016.10.26.21.05,127.799

2016.10.26.21.00,127.791

2016.10.26.20.55,127.788

 

 the indicator will plot the value accordingly to the date

i hope its a bit more clear now..

 

Thanks for your help friend! 

That`s what i have accomplished so far:

extern   string   FileName    = "AUDCAD.CSV";
datetime   dt[9999];
double     val[9999];

string     arr[2];    

int h = FileOpen(FileName, FILE_CSV|FILE_READ,'~');
  if (h==0)   Comment("File "+FileName+" not found.");

  
  for (int c=0; !FileIsEnding(h) && c<9999; c++)  {

  
    string tmp = FileReadString(h);
    if (FileIsEnding(h))  break;
    StrToStringArray(tmp,arr,",");
    dt[c]  = StrToTime(arr[0]);  // <==== This should convert the date value (in the format of "yyyy.mm.dd hh:mi") to datatime type and assign it to the array
    val[c] = StrToNumber(arr[1]); // <==== This will assign the value to the array
   

  }
  FileClose(h);

//+------------------------------------------------------------------+
void StrToStringArray(string str, string &a[], string delim=",")  {
//+------------------------------------------------------------------+
  int z1=-1, z2=0;
  for (int i=0; i<ArraySize(a); i++)  {
    z2 = StringFind(str,delim,z1+1);
    a[i] = StringSubstr(str,z1+1,z2-z1-1);
    if (z2 >= StringLen(str)-1)   break;
    z1 = z2;
    
  }
}
//+------------------------------------------------------------------+
double StrToNumber(string str)  {
//+------------------------------------------------------------------+
// Usage: strips all non-numeric characters out of a string
  int    dp   = -1;
  int    sgn  = 1;
  double num  = 0.0;
  for (int i=0; i<StringLen(str); i++)  {
    string s = StringSubstr(str,i,1);
    if (s == "-")  sgn = -sgn;   else
    if (s == ".")  dp = 0;       else
    if (s >= "0" && s <= "9")  {
      if (dp >= 0)  dp++;
      if (dp > 0)
        num = num + StrToInteger(s) / MathPow(10,dp);
      else
        num = num * 10 + StrToInteger(s);
    }
  }
  return(num*sgn);
}
I`m not sure why if i Print dt[c] it always return the same value..like time never change even if the arr[0] change on every iteration of the loop..
after this we should assign the value to the bar with that time..but im stuck..

	          
 
AtApi:
AtApi:

Thanks mladen,

let`me explain a bit better: i need an indicator that read from a CVS file and plot the values in a sub-window, the CVS will have 2 values comma separated, the first value is the date and the second is the actually value that the indicator should plot. 

for example

the CVS look like this:

Time,value 

2016.10.26.21.20,127.765

2016.10.26.21.15,127.777

2016.10.26.21.10,127.777

2016.10.26.21.05,127.799

2016.10.26.21.00,127.791

2016.10.26.20.55,127.788

 

 the indicator will plot the value accordingly to the date

i hope its a bit more clear now..

 

Thanks for your help friend! 

That`s what i have accomplished so far:

Nevermind i have solved the problem....the SrtToTime only accept string with this format: "yyyy.mm.dd hh:mi" that means that i was loading a CSV with this format instead "yyyy.mm.dd hh.mi" and obviously was giving me an error.. anyway i solved!! 
 

hello 

mr mladen:

could update it for new mt4 build

 best regard 

Files:
 

Please can anyone help me fix these 3 issues 

1. fix the trailing error

2.remove the second time frame filter,system will run on 30m chat

3.add the attached indicator as a filter on the 1D chat  

 

@Dear friends,

My ea gives the below error,.

"EURUSD+,M5: unknown ticket 21847676 for OrderDelete function"

 

What does this sentence mean? What is the problem and what can i do?

 
oguz:

@Dear friends,

My ea gives the below problem.

"EURUSD+,M5: unknown ticket 21847676 for    StringConcatenate(function"

 

What does this sentence mean? What is the problem?

What can i do?

It means that it can not find an order with ticket number 21847676 that it can delete

Either :

  • the ticket number is wrong
  •  or the order already got deleted in the mean time (two EAs, or the loop did not check properly, or anything similar ...)
 

 

 

hello mr mladen

could you help to put this indicator on MTF separate chart similar this picture 

regard 

Files:
xb4d_2.mq4  4 kb
Reason: