How can I initiate a sell based on the price value?
For example, I'm running a scalping strategy and I bought some assets, so I have the buyprice. Now I want to initiate a SELL based on if the current price went up 0,5% above the buyprice.
I can set the limit price using the actual fill price, but I may want to cancel that order if the price goes downwards and place another order. So my question is how can I access the current price to compare it with fill price
@ololo you already posted your question once. It is not unique and was discussed here several times. Also there is no 24/7 support here. Be patient, read docs, forums.
@ab_trader I thought I posted it in the wrong category because it seems to be an easy thing and nobody could answer
it seems to be an easy thing and nobody could answer
There is no obligation for community members to answer questions, especially if the answer is already shown in the docs.
The price values can be obtained using (for example)
self.data.closestatement and this is described well in the docs, quick start for example.
@ab_trader The answer isn't shown in the docs. Accessing open,high, low or close of the current bar is different from accessing current price.
Accessing open,high, low or close of the current bar is different from accessing current price
Could you please explain what do you mean by current price ?
@rajanprabu I want to realize a trading logic where I sell assets based on the buyprice. I can access the buyprice through notify_order BUT I need to compare it with something. self.data.close doesnt make it. A simple limit order doesn't make it too because if the price goes downwards I may want to place another order so the question is how do I exactly realize this: if the price went up +1% I place an order to sell, if the price went down 1% I place an order to sell
Accessing open,high, low or close of the current bar is different from accessing current price.
These are prices from the last bar. And
closeprice is last available price I.e. current price for the
next()call. There are no other prices available.