[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 467

 

Good afternoon! Question about the chart....Created a sloping line in the indicator, based on two points

if(Lineinc){
                nameUP1=WindowExpertName()+"_Up_"+Time[Num_bar_UP_2]+"_"+Time[Num_bar_UP_1-3];
                fObjTrendLine(nameUP1,Time[Num_bar_UP_1],Price_UP_1,Time[Num_bar_UP_2],Price_UP_2,false,Color_UP,1,0,0,false);
              } 

The line is displayed correctly, but it needs to be extended until it crosses the price or until the next line is formed. Can you please tell me how to do this....

I tried it this way

if (Close[i]<Line_UP)ObjectMove(nameUP1,0,Time[i],Line_UP);

but the line shifts and is not displayed correctly.....

 
 
LOA:

Good afternoon! Question about the chart....Created a sloping line in the indicator, based on two points

The line is displayed correctly, but it needs to be extended until it crosses the price or until the next line is formed. Can you please tell me how to do this....

I tried it this way

but the line shifts and is not displayed correctly.....


ConstantValueTypeDescription
OBJPROP_TIME10datetimeGets/sets the first time coordinate
OBJPROP_PRICE11doubleGets/sets first price coordinate
OBJPROP_TIME22datetimeGets/sets second time coordinate
OBJPROP_PRICE23doubleGets/sets the second price coordinate
OBJPROP_TIME34datetimeGets/sets the third time coordinate
OBJPROP_PRICE35doubleGets/sets third price coordinate
OBJPROP_COLOR6colorGets/setsthe colour of the object
OBJPROP_STYLE7intGets/setsthe object's line style
OBJPROP_WIDTH8intGets/sets the width of the object line
OBJPROP_BACK9boolGets/sets the background display flag of the object
OBJPROP_RAY10boolGets/sets the ray flag for objects like OBJ_TREND
OBJPROP_ELLIPSE11boolGets/sets a flag to display a full ellipse for an OBJ_FIBOARC object
OBJPROP_SCALE12doubleGets/sets the scale value of the object
OBJPROP_ANGLE13doubleGets/sets the angle value in degrees of the OBJ_TRENDBYANGLE object
OBJPROP_ARROWCODE14intGets/sets the arrow code of the OBJ_ARROW object. Can be one of thewingdings or one of the predefinedarrow codes
OBJPROP_TIMEFRAMES15intGets/sets the object's display property for different periods. Can be one or a combination of several of theobject's visibility constants.
OBJPROP_DEVIATION16doubleGets/sets the deviation size for the OBJ_STDDEVCHANNEL object
OBJPROP_FONTSIZE100intGets/sets font size for OBJ_TEXT and OBJ_LABEL objects
OBJPROP_CORNER101intGets/sets the corner number of the anchor for OBJ_LABEL object. Takes the values 0-3
OBJPROP_XDISTANCE102intGets/sets the distance of the X-coordinate in pixels from the angle of the anchor for OBJ_LABEL object
OBJPROP_YDISTANCE103intGets/sets the distance of the Y-coordinate in pixels relative to the angle of the anchor for an OBJ_LABEL object
OBJPROP_FIBOLEVELS200intGets/sets the number of levels of a Fibonacci object. Can be from 1 to 32
OBJPROP_LEVELCOLOR201colorGets/setsthe colour of the object's level line
OBJPROP_LEVELSTYLE202intGets/sets object level line style
OBJPROP_LEVELWIDTH203intGets/sets the width of the object level line
OBJPROP_FIRSTLEVEL+n210+nintGets/sets the Fibonacci object level values with indexn. Indexn can be from 0 to (number of levels -1), but no more than 31
 
FAQ:
OBJPROP_RAY10boolGets/sets the ray property flag for objects of type OBJ_TREND and similar

Thanks for the reply.The chart will also display the ray, but it could probably be done in a different way, i.e. the line display ends(i-2) when the price breaks at i or when a new line appears?
 
LOA:
Thank you for the answer.The chart will also display the ray, but you can probably do it in a different way, i.e. displaying the line ends(i-2) when the price breaks at i or when a new line appears?

Again, at breakdown of a line by price or a new line, take a price reading on the given bar using functionObjectGetValueByShift(), move the second price and time to the current bar and remove the ray property.
 
Ladies and Gentlemen! I'm a total zero, I hope so far) Is there a glossary of terms? Not everything is clear in the training video.
 
Ladies and Gentlemen! I'm a total zero, I hope so far) Is there a glossary of terms? Not everything is clear in the training video.
 
FAQ:

Again, when the line is broken by the price or a new line, you take a price reading on this bar using theObjectGetValueByShift() function, move the second price and time to the current bar and remove the ray property.
Ok. Thanks again, it all makes sense. I just recently started to learn programming, so maybe I'm really complicating things or I just don't know a lot of tricks....
 

I can't figure out why this code doesn't close ALL the sells, but only the freshest one?

Thank you.

 for (orderIndex = (OrdersTotal() - 1); orderIndex >= 0; orderIndex--)
           {
            if (OrderSelect(orderIndex, SELECT_BY_POS))
              {
               if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == magic))
                 {
                   if (OrderType() == OP_SELL)
                     {
                       price = Bid; 
                       clr = ColorBuy;
                       result = OrderClose(OrderTicket(), OrderLots(), price, 300, clr);
                       if (result) {if (UseSound) {PlaySound("alert.wav");  break;} } 
                       else  {error = GetLastError(); Print ( "error = ", error );}
                     }
                }
              }
           } // Конец цикла 
 
Roman.:

I can't figure out why this code doesn't close ALL the sells, but only the freshest one?

Thank you.


 for (orderIndex = (OrdersTotal() - 1); orderIndex >= 0; orderIndex--)
           {
            if (OrderSelect(orderIndex, SELECT_BY_POS))
              {
               if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == magic))
                 {
                   if (OrderType() == OP_SELL)
                     {
                       price = Bid; 
                       clr = ColorBuy;
                       result = OrderClose(OrderTicket(), OrderLots(), price, 300, clr);
                       if (result) {if (UseSound) {PlaySound("alert.wav");  } } 
                       else  {error = GetLastError(); Print ( "error = ", error );}
                     }
                }
              }
           } // Конец цикла 
After PlaySound() there is a break
Reason: