Hi, Guys,
My trading strategy is using ma cross and DC line.
the entry and exit conditions are the following:
– When the ma50 cross over ma200 then entry long position and exit short position.
– When the ma50 cross under ma200 then entry short position and exit long position.
Also, the DC up line is for adding more contracts in one direction trend. if the price high/low break DC up/down line, then entry position.
My programme code is the following
MA50 = Average[50](close)
MA200 = Average[200](close)
DCUP = DonchianChannelUp[100]
DCDOWN = DonchianChannelDown[100]
// Conditions to enter long positions
A = MA50 > MA200
B = HIGH > DCUP
IF A THEN
BUY 1 CONTRACT AT MARKET
ELSIF A AND B THEN
BUY 1 CONTRACT AT MARKET
ELSE
ENDIF
// Conditions to exit long positions
IF MA50 < MA200 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
C = MA50 < MA200
D = LOW < DCDOWN
IF C THEN
SELLSHORT 1 CONTRACT AT MARKET
ELSIF C AND D THEN
SELLSHORT 1 CONTRACT AT MARKET
ELSE
ENDIF
// Conditions to exit short positions
IF MA50 > MA200 THEN
EXITSHORT AT MARKET
ENDIF
The problem is the entry position is not the same as my plan. so I don’t know how to solve this problem.
Thank you very mcuh.
Something typo
The exit conditions are when the price high/low breakout ma200.
Wing Tai Tin – Thank you for posting your strategy.
There are some simple rules that you are expected to follow when posting in the forums. One of them is to post your topic in the correct forum. The ProOrder forum is the correct place for your topic not the General Discussion forum. Another rule is that you should use the ‘Insert PRT Code’ button when posting code.
I will move your topic and tidy up the code but please try to post more carefully with future posts.
So far you have posted two topics in the wrong place, given one a meaningless title and failed to use the insert PRT code button in the other. It is not a great start! 🙂
If you want to use crossovers you should use CROSSES OVER and CROSSES UNDER instead of > and <, when comparing the two MA’s.
thank you, sir!!
but what’s the difference between “>”, “<” and cross over, cross under. I read the foundation pdf and but I still don’t really understand
< is less than.
> is greater than.
CROSSES UNDER and CROSSES OVER are exactly what they say – price in the candle started on one side of your value and closed on the other side of your value.
So the following are the same thing:
if a crosses over b then
if a[1] < b[1] and a > b then