[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1004

 
Vinin:

You can pass either an array or a variable. In your case it was an array element.
Thanks, Vinin!
 

How do I forcibly abort the test? Dividing by zero doesn't help, it used to.

 
001:

How do I forcibly abort the test? Dividing by zero doesn't help, it used to.

Just write a condition in your EA, when it stops processing its body, it won't work and the story will fly in 5 seconds.
 
Techno:
Simply write a condition in the EA that it stops processing its body, it will not work and the story will fly by in 5 seconds.

That's an interesting idea. Nothing immediately comes to mind.....
 

Hi all! Can you give me a hint?

//+------------------------------------------------------------------+
//| Sinus.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp.
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 8 // number of buffers 8
//---- input parameters
extern color Color_1 = DodgerBlue; //colour
extern int Tolshina =2;
int i; // Formal parameter, counter

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int LinesCNT=0,i;
int handle;
handle=FileOpen('D1.csv',FILE_CSV|FILE_READ,';');
if(handle<1)
{
Print("File D1.dat not found, last error ", GetLastError());
return(false);
}
while(true)
{
FileReadString(handle);
if(FileIsEnding(handle)) break; // file ended? - exit

// count coordinates of the segment
i++;
string st1=FileReadString(handle);
string sp1=FileReadString(handle);
datetime t1=StrToTime(st1);
double p1=StrToDouble(sp1);
FileSeek(handle,0,SEEK_CUR );
string st2=FileReadString(handle);
string sp2=FileReadString(handle);
datetime t2=StrToTime(st2);
double p2=StrToDouble(sp2);

// draw a line segment
LinesCNT++;
string LineName = (LinesCNT); // create a name for the new line
ObjectCreate(LineName,OBJ_TREND,0,t1,p1, t2,p2); // create a line
if(!ObjectCreate(LineName,OBJ_TREND,0,t1,p1, t2,p2))
{
Print("Line creation failed",GetLastError());
return(0);
}
ObjectSet(LineName,OBJPROP_RAY,False); // make it a line segment instead of a ray
ObjectSet(LineName,OBJPROP_WIDTH,Tolshina); // set the width
ObjectSet(LineName,OBJPROP_COLOR,Color_1); // set colour
ObjectSet(LineName,OBJPROP_PRICE1,p1);
ObjectSet(LineName,OBJPROP_PRICE2,p2);
//---------------------------------------------------
WindowRedraw();
// redraw the window to see the line
}
//---------------------------------------------------------

FileClose(handle);


//----
//----
return(0);
}
//+------------------------------------------------------------------+
Can you tell me what's wrong in the code? My file has 2 columns, and many rows, separated by a semicolon..... The first date is read, but the price is not..... The second one is not there at all ...... And maybe you can tell me how to make a line to be a line segment and plotted one after another ...( I think I specified that the beam should be ). There needs to be a loop, right?

 

it's not like that in your File and in the program :) and why did you post only 3 posts? would it have been too much to ask the same thing in 8 posts?... (you were already banned for spamming - and you didn't get it?

- Save the archive and the date file and put it in the post - it doesn't take much tweaking...

 
Aleksander:

it's not like that in your File and in the program :) and why did you post only 3 posts? would it have been too much to ask the same thing in 8 posts?... (you were already banned for spamming - and you didn't get it?

- Save the archive and the date file and put it in the post - it doesn't take much tweaking...


Hi!
What's wrong with the file?! ....... Please help me, I'm already confused with this programming, I don't know anything about it.....

Files:
sinus.rar  30 kb
 
Question - where do you display the graph? on the days? I take it on the Euro? :) - since 1990? - overlay on the price chart or display it in a separate window?
 
Aleksander:
Question - where do you display the graph? on the days? i assume on the euro? :) - since 1990? - overlay on the price chart or display it in a separate window?

You do not need a separate window. And the period does not make any difference in principle... It should be reflected on any.... These are the segments that are not directly linked to the price chart... or am I missing the point...
 
All calculated for Euro and month1,d1,week.... But it should be displayed on any chart where you throw the indicator.... Is it the same? And counting from the first line, there date and price, then the second date-price, the segment should be built, then the next date-price, the segment from 2 to 3. etc.
Reason: