MnAParticipant
New
Hi, I want to buy at market immediately as the live price crosses above the prior bar high.
Sounds simple but when I use
If Close crosses over high [1] then buy position at market ….. the system waits until the current bar closes and then validates the command… I want the order to launch immediately as price moves above the prior high
Can you guys help please…what is the correct coding word to get the system to send the order immediately as the live price goes above the high of the prior bar ?
thank you
You can place a STOP pending order:
BUY 1 Contract AT high STOP
Roberto is so busy helping folks with their coding problems that he forgot to say …
BUY 1 Contract AT high[1] STOP //[1] gives prior bar high
I think he used [1] because he had to wait for the next bar to close before entering at Market. With a pending order, instead, he can place the order on the same bar whose HIGH is to expected be later crossed (while the next candle is forming).
Actually I am writing so many lines of code daily, that I sometimes happen to mistakingly write some code while thinking of prior posts. So any help or suggestion from whoever is highly welcome 🙂
MnAParticipant
New
Apologies, it is still not working…the current bar goes above the prior bar’s high…but does not send any order..It just waits for the bar to close…then it sends the order..I want the system to send the market order immediately .
is this possible? thank you
my simple code is below
// Conditions to enter long positions
indicator1 = close crosses over high[1]
IF indicator1 THEN
BUY 10 PERPOINT AT high [1] stop
ENDIF
SET TARGET PROFIT 10
SET STOP PLOSS 10
Hi MnA, this could partly be a matter of how to judge what happens really. I mean, if I look at your screenshot in your last post, it seems to show what you want to happen. So without further context, would you agree that it shows all right (in a static picture) ?
OK, maybe I just don’t get it (I *do* understand what you want to happen) … the blue line, including the little green triangle, shows fine – at the correct place. But where is that next bar of which you say that only “there” the trade happens ?
Or did you draw this with MSPaint and does it only show what you want to happen ?
MnAParticipant
New
Hi , the static image was to show what should happen… so… on current bar.. as it is forming…Buy at blue line (which is above the prior’s bar high).
But the code seems to only send the order once the current bar closes not as it is forming ?… sorry Im confused.
Thank you
You cannot enter with a STOP order AFTER high[1] is crossed over.
Use a LIMIT order, instead.