Place LMT order from Specific Price
Place LMT order from Specific Price
02 Aug 2022, 10:40
Hi there,
I'de like to place a LMT order from the last bars high price.
I can't quite figure out how to combine the two items.
I can get the last bars high price with.
Print("High: {0}", Bars.HighPrices.Last(1));
Then I can place a LMT order like this
PlaceLimitOrder(TradeType.Buy, SymbolName, 2000, Symbol.Bid,"myLimitOrder");
But I really want to replace Bid with a variable price that is the last bars high value.
eg something like.
var price = Bars.HighPrices.Last(1);
PlaceLimitOrder(TradeType.Buy, SymbolName, 2000, Symbol.price,"myLimitOrder");
Any suggestions?
Replies
ctid2434759
02 Aug 2022, 11:16
( Updated at: 02 Aug 2022, 11:24 )
RE:
Thanks!
So I actually want to do.
The last bars high minus a specific number of pips.
So I got your code to work
PlaceLimitOrder(TradeType.Buy, SymbolName, 2000, Bars.HighPrices.Last(1),"myLimitOrder");
Then added this to be the final value of 6 pips bellow.
PlaceLimitOrder(TradeType.Buy, SymbolName, 2000, Bars.HighPrices.Last(1)-6*Symbol.PipSize,"myLimitOrder");
Thanks so much for your help.
Now I'm onto the next step which I really want to figure that out myself but I'm sure I'll be in touch. ha
@ctid2434759
PanagiotisCharalampous
02 Aug 2022, 10:49
Hi there,
The code should be
but it will not work since you cannot place buy limit orders above the market price. It needs to be a stop order.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous