close position in zerocode

 

hello

I trise to put my simple ruls at zerocode

i hope its o.k.

i dont know if i did it right

i wish i could ask somwone

i need to put a closing position and i dont know how:

logic: is the price line croses 3 ema 10, 25. 50 then close posotuon

can somwone help me please

thanks

 

Why cross 3 EMAs? I asked because when the price crosses EMA 50, it must have crossed EMA 10 and 25 already. I think just check if the price cross EMA 50 alone is way efficient.

To close positions if bid price cross an EMA (setup up the period in step 1):

Close Logics

PriceBid <= MA (x) Previous
PriceBid > MA (x) Current

Note: Replace the x with appropriate indicator's id found in popup menu.

 

Scorpion, How would you write your close if your EA was designed for both long and short positions. In other words, how would you write:

If Long, close when EMA(1) crosses EMA(2) to downside;

else

if short, close when EMA(1) crosses EMA(2) to upside;

Thanks alot, freshfx

 

I think I have answered the question I asked above in the previous post.

CLOSE LOGIC

AND MA(1)previous<MA(2)previous

AND MA(1)current>=MA(2)current

OR MA(1)previous>MA(2)previous

AND MA(1)current<=MA(2)current

I would appreciate comment, thanks. freshfx

 

Hey,

Above logics will close trade all the time regardless of buy or sell, so don't use it. I'm thinking to add "close only long" and "close only short" in the next version.

Reason: