How can i draw a dot on my chart? - page 2

 
EagleEye:

Ok i have now cooked it down to this. And it works perfect. Thanks!


Nice Code ...  works very well for me!

.... but I getting some warnings and don't know how to get rid of them - any ideas?


possible loss of data due to type conversion
CharToStr(Code)


Here is my code:  Anchorpunkt is an MA Line as example.


void Draw_down(string objName, int Code,int Fontsize,color LineColor, double Anchorpunkt)   
{  
         ObjectCreate(objName+ (string)Time[0], OBJ_TEXT, 0, Time[0], Anchorpunkt); 
         ObjectSetText(objName+ (string)Time[0], CharToStr(Code), Fontsize, "Wingdings", LineColor); 
}

void Draw_up(string objName, int Code,int Fontsize,color LineColor, double Anchorpunkt)   
{  
         ObjectCreate(objName+ (string)Time[0], OBJ_TEXT, 0, Time[0], Anchorpunkt);
         ObjectSetText(objName+ (string)Time[0], CharToStr(Code), Fontsize, "Wingdings", LineColor); 
}
 
frobber: .... but I getting some warnings and don't know how to get rid of them - any ideas?
You are passing an int to CharToString not a char. Change the data type of Code.
 
whroeder1:
You are passing an int to CharToString not a char. Change the data type of Code.

Can you help me in that?


Tried to change it into: (string objName, char Code,int Fontsize,color LineColor, double Anchorpunkt)

But now I get a lot off erros: truncation of constant value


Thanks very much in advance.


 
frobber:
Tried to change it into: (string objName, char Code,int Fontsize,color LineColor, double Anchorpunkt)

But now I get a lot off erros: truncation of constant value

  1. That is what I meant.
    #property strict
    void test(char c){}
    void OnStart(){
       test(2);
    }
    
    This compiles just fine.
  2. If you have problems then you are not passing a character and CharToString makes no sense.
 

Sorry but I am still lost ;(


I can see the problem - I add an integer variable to the function and want to use that with the function CharToStr.

But it works and drawsWingdings-symbols ....with my color, size and the position I want... but it throughs that warning.


No matter what I try to change it stops working or draw not the symbols I entered as integer-number.

Can you tell me exactly what I need to change to have no more warnings ?

 
frobber: Can you tell me exactly what I need to change to have no more warnings ?
No I can't, because I'm not a mind reader. I can't see your broken code.
Reason: