AmerParticipant
Junior
hope someone can help me. It is possible that when you work with automated trade, you can program the following. example when macd cross over value 0, buy but first 10 pips up. or more exactly put an order 10 pips up when macd cross over 0 value. thanks in advance
once buytrigger=0
MACDHist = MACD[12,26,9](close)
if MACDHist crosses over 0 then
buytrigger=close+10*pipsize
endif
if buytrigger>0 then
buy 1 contract at buy trigger stop
endif
if MACDHist crosses under 0 and buytrigger>0 then
buytrigger=0
endif
Here you go.
Hi, im still trying to learn and was wondering what the buytrigger does?
Not sure what this means: Close+10*pipsize
also what does this do:
buy 1 contract at buy trigger stop // Did u mean buy 1 contract at buytrigger? What does the “stop” on the end do?
There should of course be written “buytrigger” in one word. It was separated by the autocorrect function of my computer and I did not read through what I wrote before posting, sorry for that.
Your other question I’m not sure about. The code does exactly what Amer asked for. When the MACD crosses over zero it put a buy order 10 pips above the close and keeps this level as buytrigger until the MACD crosses under zero again. I think all is correct besides the “buytrigger” which had a space in the middle. 🙂
AmerParticipant
Junior
This is it i think. I will test it and come back with results. Thank you very much.
Regards Amer
AmerParticipant
Junior
a bit difficult to explain, but what I'm looking for is the same as currently available on automated trading in
prorealtime. example macd cross over 0 value 10 periods ago. but in my case I'm looking for distance of 10 pips ass
buytrigger insted of 10 periods ago.
This is exactly what the code does. It set a buy stop 10 pips about the value of the close when the MACD crossed zero.
AmerParticipant
Junior
thanks again. will test it soon.
EricParticipant
Master
if it dont work try change the name “buytrigger”
once trigger=0
MACDHist = MACD[12,26,9](close)
if MACDHist crosses over 0 then
trigger=close+10*pipsize
endif
if trigger>0 then
buy 1 contract at trigger stop
endif
if MACDHist crosses under 0 and trigger>0 then
trigger=0
endif