Ask Your Question
0

What is the configuration for setting a long condition using Pinescript Ichimoku?

asked 2023-05-06 23:58:14 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-05-07 00:22:02 +0000

scrum gravatar image

Here is an example configuration for setting a long condition using PineScript Ichimoku:

//@version=4
study(title="Ichimoku Cloud", overlay=true)

conversionPeriods = input(9, title="Conversion Line Periods")
basePeriods = input(26, title="Base Line Periods")
laggingSpan2Periods = input(52, title="Lagging Span 2 Periods")
displacement = input(26, title="Displacement")

conversionLine = avg(highest(high, conversionPeriods), lowest(low, conversionPeriods))
baseLine = avg(highest(high, basePeriods), lowest(low, basePeriods))
spanA = avg(conversionLine, baseLine)

laggingSpan1 = close[displacement]
laggingSpan2 = avg(highest(high, laggingSpan2Periods), lowest(low, laggingSpan2Periods))[displacement]

colorCloud = spanA > spanB ? color.green : color.red
fill(spanA, spanB, color=colorCloud, transp=80)

longCondition = crossover(price, spanA) and crossover(price, spanB)

plot(laggingSpan1, linewidth=3, color=color.purple, title="Lagging Span 1")
plot(laggingSpan2, linewidth=3, color=color.orange, title="Lagging Span 2")

plot(conversionLine, color=color.blue, title="Conversion Line")
plot(baseLine, color=color.red, title="Base Line")

This code sets the conditions for a long position, which is when the price crosses above the Ichimoku Cloud (formed by Span A and Span B). The long condition is set using the crossover function to check for when the price crosses over both Span A and Span B.

Note that this is just an example configuration, and you may need to adjust the settings to match your trading strategy and preferences.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-06 23:58:14 +0000

Seen: 11 times

Last updated: May 07 '23