Pinescript valuewhen conversion to Ctrader

Created at 25 Dec 2023, 02:27
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
BR

brett_holliday

Joined 25.12.2023

Pinescript valuewhen conversion to Ctrader
25 Dec 2023, 02:27


Hello,

 

I have a pinescipt indicator that is using this line:

MACD_HL_clas_check = macd_val[5] > ta.valuewhen(pivot_low_clas_true, macd_val[5], 1)

This is the function definition:
valuewhen(condition, source, occurence)
Returns the value of the source series on the bar where the condition was true on the nth most recent occurrence. not the most recent, but the 2nd most recent

I am having trouble converting the “valuewhen” function to Ctrader. Can anyone help please??


@brett_holliday