I want to generate an 'idealsignal' for a stock and display it on a plot along with the stock price
And I am pretty new to writing quantopian algorithms
I am trying to do it using @batch_transform
All the examples of transforms I have seen use past data to calculate new transforms.
Such as a MovingAverage() uses mean() on the past N bars that is passed to it.
My idealsignal() should return 1, -1 and 0 based on the future N bars and a minimum profit percentage P
profit=((future_price-current_price)/current_price)*100
if profit > P: # price appreciates by more than P% within the next N bars
return 1
elif profit < -P: # price depreciates by more than -P% within the next N bars
return -1
else:
return 0 # hold otherwise
I want to be able to generate and see this signal on the graph.
From what I can tell, all of quantopian algorithm try to not show future data, which sort makes sense.
But when training model it I need to train on past data, but use ideal signals which essentially use future bars from within this historical/past price or other data.
OR
may be what I need to do is generate ideal signals in the past based on current bars which also I am not sure how to do.
Thx
Sarvi