'alert for Ichimoku setup in diffrent timeframes

Hi I am new to Pine and would like tyo ask if it possible with Pine to write a program that sends me an alert when in ichimoku indicator, the conversion line is above the baseline on the 4 hr, 1 hr, 15min and 5 min timeframe? If yes, where can I find some sample code pls? Thanks in advance



Solution 1:[1]

You need to use request.security() to get data from higher timeframes.

You can modify the original code. Something like below:

baseLine_1h = request.security(syminfo.tickerid, "60", baseLine[1], lookahead = barmerge.lookahead_on)
baseLine_4h = request.security(syminfo.tickerid, "240", baseLine[1], lookahead = barmerge.lookahead_on)

is_buy = (conversionLine > baseLine_1h) and (conversionLine > baseLine_4h)
alertcondition(is_buy, "Buy")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vitruvius