Fixed profit target with intraday data
Author: 07nioe
Creation Date: 11/28/2016 4:08 PM
profile picture

07nioe

#1
Hi Eugene,

I use a mix of daily and intraday data for my strategy. Almost all indicators are based on daily calculation. To determine the profit target, calculation doesn't work as it should do. The idea is to calculate the profit taget on the Close of the last day and leave it there for the whole trade - no adjustments. Due to intraday data I use the following code to determine the relevant bar:

CODE:
Please log in to see this code.

Unfortunately, the profit target level changes from day to day. It is not fix.
If i use
CODE:
Please log in to see this code.

the profit target changes even from bar to bar.
What do I have to do?
Thank you very much.

Best
Niels
profile picture

Eugene

#2
Hi Niels,

Not sure if I understood you on what "the Close of the last day" is. If it's the bar preceding the bar of entry and the idea is to fix it throughout the trade, then isn't it something like this?

CODE:
Please log in to see this code.
profile picture

07nioe

#3
Eugene,

maybe I haven't made myself clear. An example may help:

you use 5 minute intraday data and the strategy goes long at 10.05 am. To calculate the take profit, I would like to use the close of the preceding DAY. The preceding bar of entry would be the one at 10.00 at the SAME day.
profile picture

Eugene

#4
Got it. You have to save the profit target level somehow, for instance in a DataSeries (and propagate the value on bars where it's not being set):

CODE:
Please log in to see this code.
profile picture

07nioe

#5
okay! But why don't you use
CODE:
Please log in to see this code.
in
CODE:
Please log in to see this code.
?

Meanwhile I tried the following variety:

CODE:
Please log in to see this code.

It seems to work.
profile picture

Eugene

#6
QUOTE:
But why don't you use

This was just an illustration. I leave the actual implementation up to you.

QUOTE:
It seems to work.

Good solution.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).