mardi 29 septembre 2020

Pine Script - If statement with a plot

I am new to Pine Script but hoping to get some assistance with two IF statements and based on the outcome I need to plot a flat line for the week (Monday to Friday), the following week the Marker (see below) should re-calculate.

pLevel = (prevHighHTF + prevLowHTF + prevCloseHTF) / 3
r1Level = (pLevel - prevLowHTF) + pLevel
s1Level = pLevel - (prevHighHTF - pLevel)


//Marker Calculations
// Close above Pro_High on Friday
if prevCloseHTF[1] > r1Level[1]
    Marker = r1Level - ((r1Level - prevCloseHTF) * 0.55)

//Close Below Pro_Low on Friday
if prevCloseHTF[1] < s1Level
    Marker = ((prevCloseHTF - s1Level) * .55) + s1Level

Using this code, How can I plot the Marker on Monday as a single line and recalculated the following week?

Aucun commentaire:

Enregistrer un commentaire