[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 133

 

TickSave from the composter misses some ticks, and also when the demo server reconnects it doesn't create a new folder and doesn't write to the old one

Still, what is the best script or Expert Advisor to collect ticks?

 

Tell me how many decimal places the decimal point should be.

Example.

In the terminal the price is 1.44996. However, all functions return only 1.4499 or 1.4450. Are there any methods to search for values with 5 decimal places?

Because of this I cannot figure out what to do with stop loss. I was guided by the terminal reading 1.4xxx. And I put a stop loss at 200 points. It is normally placed at 1.40000 - 200 = 1.39800, for example.

However, logically, the function returns only 1.4xxx should be 1.4000 - 200 = 1.3800. What am I doing wrong? =(

 
DoubleToStr
 
sergeev:
DoubleToStr

Oooh.... Thanks.

So there was automatic rounding to 4 after the decimal point.

 
ChAnton:

Oooo.... Thanks.

So there was automatic rounding to 4 after the decimal point.


When printed on Print/Comment without any other text, yes.

But the number remains a number. So don't forget to apply NormalizeDouble when sending trade requests

 

The horizontal segment is set as follows (will be to the right of Time[0]):

         datetime Time_TLINE_Left  = Time[0]         + Period()*60*15;
         datetime Time_TLINE_Right = Time_TLINE_Left + Period()*60*10;

         if(ObjectFind("MyLine_Buy")==-1) {
            string       Line_Buy  = "MyLine_Buy";
            ObjectCreate(Line_Buy, OBJ_TREND,  0,  Time_TLINE_Left,Ask,  Time_TLINE_Right,Ask);
            ObjectSet(   Line_Buy, OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet(   Line_Buy, OBJPROP_RAY,   False);
            ObjectSet(   Line_Buy, OBJPROP_WIDTH, 3);
            ObjectSet(   Line_Buy, OBJPROP_BACK , True);
            ObjectSet(   Line_Buy, OBJPROP_COLOR, Color_Only_Buy);
         }

With each new bar the segment is deleted and redrawn.

Occasionally a day after the current day is missed (i.e. it's not on the chart, but an attempt is made to draw a segment for it) - for example on weekends:

Time[0] corresponds to Friday, and the segment is created for Saturday, when there is no trading.

In this case, the logic is broken.

- We need to find a way to identify such days that don't exist, and not to draw line segments for them.

Maybe someone has an idea how to do it?

(Checking the day of the week does not cover all possible options, such as holidays)

Thanks!

 
chief2000:

Does anyone have an idea how to do this? (Checking days of the week doesn't cover all the possibilities)

We need to detect a gap in quotes, compare Time[0] and Time[1] on days or so... If there is no gap, then we draw as usual, if there is then we need to think what to do in this case.

 
splxgf:

We need to detect a gap in the quotes, compare Time[0] and Time[1]... If there is no gap, then we draw it as usual, if there is, then we should think what to do in this case.

Time[1] is to the left of Time[0] and the segment is drawn to the right of Time[0] at some distance from it.

I thought that a segment drawn for a non-existent day (e.g. Saturday) should have some unique properties, like a point. But the problem is that this point has the correct time in the properties - the left and right coordinates of this segment-point do not have the same time (for a real point the time would be the same).

If it were possible to find something specific, then it would be possible to simply delete such a segment.

 

compare with Time[1] only to detect holidays/weekends.

And why is there an attempt to redraw, there are no ticks, you can check that trades are closed for looped scripts.

 
splxgf:

compare with Time[1] only to detect holidays/weekends.

And why is there an attempt to redraw, there are no ticks, you can check that trades are closed for looped scripts.

The problem occurs on the first bar of the first day of the trading week - the segment crosses Time[0] although it should always be at a given (fixed) distance from it.

At the beginning of the week, it turns out that the time of the left coordinate of the segment becomes less than the time of Time[0] opening.

Perhaps your solution of checking for a gap between Time[0] and Time[1] may solve the problem but I will have to sacrifice the first bars at the beginning of the week (this is acceptable). I will check it tomorrow.

Thank you!

Reason: