program for Automatic close of position

 

I am trader comming to MT4 from tradestation i get positions open for long time (1H and Daily charts) i can stay at the front of my computer 24h to close

my position when things happent (so i avoid to take 1H chart) i would like to close the position when prices close above(below) a MA or when one MA cross the other

it is there any help?

my e-mail : tranco@inbox.com

 
if (NewBar())
   {
   if (iClose(Symbol(), YourTimeFrame, 1) > Your MA)
      {
      for (....)
         {
         OrderSelect(.....);
         if (its your Order u want to close)
            {
            OrderClose(........);
            }
         }
      }
   }

bool NewBar () 
   {
   static datetime LastTime = 0;

   if (Time[0] != LastTime) 
      {
      LastTime = Time[0];     
      return (true);
      }
   else
      return (false);
   }
 
qjol:


Hi gjol thnks for you fast reply but i am not a programmer i am pure trader of the old school plus i came to MT4 from trade station

so this code you wrote is ready one and if yes hou to put it in the idicators?

thnks in advance

 
sakis:


Hi gjol thnks for you fast reply but i am not a programmer i am pure trader of the old school plus i came to MT4 from trade station

so this code you wrote is ready one and if yes hou to put it in the idicators?

it's not a ready one i wrote it special for u of course it's not ready to go it's only the the idea how to do it

thnks in advance

 

I had written an EA, maybe it can do some help. https://www.mql5.com/en/code/9210


sakis:

I am trader comming to MT4 from tradestation i get positions open for long time (1H and Daily charts) i can stay at the front of my computer 24h to close

my position when things happent (so i avoid to take 1H chart) i would like to close the position when prices close above(below) a MA or when one MA cross the other

it is there any help?

my e-mail : tranco@inbox.com

 
GreatShore:

I had written an EA, maybe it can do some help. https://www.mql5.com/en/code/9210




Hi great shore thnks for your reply i try to open that ling but does not work
 
qjol:


Hi Gjol

so what you want me to do ?

i am sorry i am asking its because iam new in the forum

 

There is no new tick in the weekend. You can try it in market time.


sakis:

Hi great shore thnks for your reply i try to open that ling but does not work
 
GreatShore:

There is no new tick in the weekend. You can try it in market time.




nop, the link you gave is incorrect you probably meant this one https://www.mql5.com/en/code/9210
 

sorry, I pasted wrong link, you are right.


qjol:

nop, the link you gave is incorrect you probably meant this one https://www.mql5.com/en/code/9210
 
GreatShore:

sorry, I pasted wrong link, you are right.




what does this idicator ??

i just need to instruct the system to close when prices close above or below certain MA or when fast MA cross slow MA

Thnks for help you are great

if you need any trading help i am on your services i had trade the markets since 1986 working in finance institutions

i can't program because i am of the old school but i can revele trading systems that used by institutions well prooved and simple

Reason: