Hi,
Im not very good at coding, can anyone support by building the code for an ema crossover system.
I’m looking at using 10 and 25 ema.
- buy when the 10 ema cross’s the 25 ema in an upward direction and close when it crosses in a downward direction.
- sell when the 10 ema cross’s the 25 ema in a downward direction and close when it cross’s in an upward direction
can anyone do this for me
please email.
rsd001 – Welcome to the forums. If you post your request in the correct forum then you might have a better chance of some assistance. ProBuilder is for indicator questions and ProOrder is for strategy questions. I will move your topic to the correct forum. Please try to be more careful when posting future topics to ensure that they are in the right place. 🙂
What you’ve described would look like this:
indicator1 = ExponentialAverage[10](typicalPrice)
indicator2 = ExponentialAverage[25](typicalPrice)
c1 = (indicator1 > indicator2 and indicator1[1] < indicator2[1])
c2 = (indicator1 < indicator2 and indicator1[1] > indicator2[1])
You then add c1 and c2 to your entry and exit conditions as necessary.
If you’re interested in this kind of strategy you should also have a look at this:
Optimization moving average crossing strategy
a program that finds optimal pairs of 69 different crossing MAs.
The whole thing would look something like this:
DEFPARAM cumulateOrders = False // Cumulating positions deactivate
Defparam flatbefore = 080000
Defparam flatafter = 163000
//strategy
indicator1 = ExponentialAverage[10](typicalPrice)
indicator2 = ExponentialAverage[25](typicalPrice)
c1 = (indicator1 > indicator2 and indicator1[1] < indicator2[1])
c2 = (indicator1 < indicator2 and indicator1[1] > indicator2[1])
// Conditions to enter long positions
IF NOT LongOnMarket AND c1 THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
// Conditions to exit long positions
If LongOnMarket AND c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
IF NOT ShortOnMarket AND c2 THEN
SELLSHORT 1 CONTRACTS AT MARKET
ENDIF
// Conditions to exit short positions
IF ShortOnMarket AND c1 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets : Enter your protection stops and profit targets here
SET STOP %LOSS 1
SET TARGET %PROFIT 2
@nonetheless.
this is great, ill try it today.