Addlabel coding question

Vorlauf

New member
I have the two following Labels, I'm hoping to find a code that would take the 2 values provided from these two labels and return a new AddLabel that would return the stop loss percentage. Like 1-(stop/buy) as a percentage

Code:
AddLabel(yes, "Stop: " + AsText(stopLoss), Color.RED);
AddLabel(yes, "Buy: " + AsText(Close), Color.MAGENTA);
 

BenTen

Administrative
Staff
VIP
@CapitaineFlam88 Are you sure? It worked for me. Check out the AddLabel() thread to learn more.

Mu6nDD9.png
 

Marvin187

New member
How do I add a condition that makes the statements below false after 2-3 seconds? I would like the labels to switch back to "NO SIGNAL" after 2-3 seconds.

Code:
#Labels
AddLabel(yes, if UpSignal[1] then "BUY BUY BUY" else "NO SIGNAL", Color.YELLOW);
AddLabel(yes, if DownSignal[1] then "SELL SELL SELL" else "NO SIGNAL", Color.WHITE);
 
Last edited:

rad14733

Well-known member
VIP
@Marvin187 You really can't unless you could monitor when the signal fires and base the yes/no off of current time minus trigger time... Whether a few seconds timespan would work or not is subjective... Personally, if I were to try this I would do the calculation prior to the AddLabel() statement itself and place the resulting variable in place of yes...
 

Marvin187

New member
@rad14733 Can you help me make the code? I’m aware we will have to make another condition and add to label statement. Sample -> AddLabel(yes, if UpSignal[1] then "BUY BUY BUY" else if <NEW CONDITION> then “NO SIGNAL” else "NO SIGNAL", Color.YELLOW);

The NEW CONDITION has to work based on what you mentioned.
 

rad14733

Well-known member
VIP
@Marvin187 It might be a while before I can get to it with the other coding work I am working on in addition to trying to help keep questions answered here in the forums... I know @XeoNoX is seemingly the resident wizard for time-related solutions and perhaps he could squeeze it in sooner, unless someone else has the desire to jump in... If too much time passes, give another reminder...
 

Similar threads

Top