#### 9:1Trading

##### New member

I have been struggling for a week trying to figure out how to do this..

I want to plot a line that starts at a defined signalBar and runs for 15 bars.

Here's my base code. What am I doing wrong?!?

Thank you all sooo much for any help you can give me!

I want to plot a line that starts at a defined signalBar and runs for 15 bars.

Here's my base code. What am I doing wrong?!?

Thank you all sooo much for any help you can give me!

Code:

```
def CallPT1 = if signalbar then UpTarget1 else Double.NaN;
def PutPT1 = if signalbar then DownTarget1 else Double.NaN;
def CallPT2 = if signalbar then UpTarget2 else Double.NaN;
def PutPT2 = if signalbar then DownTarget2 else Double.NaN;
plot CT1 = CallPT1;
plot CT2 = CallPT2;
plot PT1 = PutPT1;
plot PT2 = PutPT2;
PT1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PT1.SetDefaultColor(Color.RED);
CT1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
CT1.SetDefaultColor(Color.GREEN);
PT2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PT2.SetDefaultColor(Color.RED);
CT2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
CT2.SetDefaultColor(Color.GREEN);
```

Last edited by a moderator: