PBtrading111
New member
Hello all, im new to thinkscript. My request is pretty straight forward.
I am working on coding out my own strategy, and im now working on the exit signal, now that the entry signal is working pretty well.
What I need thinkscript to do is to hold the entry price in a variable and remain constant.
Right now I am using
def entrypoint = if trigger then GetValue(data = open, 0) else Double.NaN;
and this is pulling the open price when my trigger conditions are a go, but this also changes on the very next bar where those conditions are true.
I need this because in other parts of the code im calculating my risk by basically doing this logic
Maximum dollars at risk / Entry point - Stop loss point = Max shares
So what I want this variable to be held constantly for is so I can do something like :
Goalpoint = Entrypoint + say 2 ATRS or something ;
Then finally something like
AddOrder(OrderType.SELL_TO_CLOSE, close > goalpoint);
appreciate any light that can be shed on this. Thanks
I am working on coding out my own strategy, and im now working on the exit signal, now that the entry signal is working pretty well.
What I need thinkscript to do is to hold the entry price in a variable and remain constant.
Right now I am using
def entrypoint = if trigger then GetValue(data = open, 0) else Double.NaN;
and this is pulling the open price when my trigger conditions are a go, but this also changes on the very next bar where those conditions are true.
I need this because in other parts of the code im calculating my risk by basically doing this logic
Maximum dollars at risk / Entry point - Stop loss point = Max shares
So what I want this variable to be held constantly for is so I can do something like :
Goalpoint = Entrypoint + say 2 ATRS or something ;
Then finally something like
AddOrder(OrderType.SELL_TO_CLOSE, close > goalpoint);
appreciate any light that can be shed on this. Thanks