Relative Content

Tag Archive for pine-scriptpine-script-v5

Strategy script is running with no errors but I get no trades

I am having trouble with my strategy script. I am using an ATR and a hull moving average to determine my entry and exit conditions. However, when I run the code, it runs with no error but I dont see any trades executed based off of the specific conditions. Am I doing something wrong with my code?

Retrieve historical candle data by dayofweek and specific time

I try to build an indicator to get the ranges of candles by the same day of week, hour and minute, then to compare the current candle range with the average.
I use last_bar_time to get the bar time of last candle displayed by the chart.
When the engine loops through bar_indexes from 0 till the end, if the dayofweek, hour and time are matched with last_bar_time details, store the values in an array.

Pine script Date validation

I have a scenario as below in pinescript.
I provide 4 dates in user input.
Example
Input 1 – 2024-07-10
Input 2 – 2024-07-17
Input 3 – 2024-07-24
Input 4 – 2024-07-31