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 understand how can I access the buyprice but didn't find any example with current price
-
@ololo I might be mistaken, but I think that if you want to set the limit price using the actual fill price of the trade, you will need to issue an order immediately after the fill, in
notify_order
, when the price becomes available. -
@run-out yes 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 Im new here and perhaps not much help, but from the Orders-General page in the docs:
Member Attributes:ref: unique order identifier
created: OrderData holding creation data
executed: OrderData holding execution data
so you can reference the order.exectuted attribute and compare with the data[0]'s which is current price of feed in handled in the strategy logic I believe.