Help Me..Want to Open and Close One Position in 1 Candle..

 

Hi all..

i'm a Newbie in this Forum :)

now I Very interested in EA Development..

"How I Can Open And close Just One Position in 1 Candle?.."

How I must Write the Code..


Pleas Help Me..

Thank BEfore :)

 

https://book.mql4.com// If you don't have some programming background then you can search for introduction program materials on the web. There are also links on the top of the forum for stuff like documentations, articles etc. 

 
ubzen:

https://book.mql4.com// If you don't have some programming background then you can search for introduction program materials on the web. There are also links on the top of the forum for stuff like documentations, articles etc. 


Thank's For your Answer..


I have Try Write Some Code :

//For open Position Buy Or SELL

if (OrdersTotal()==0)
   { 
      if ( iOpen(Symbol(),1,0) < iClose(Symbol(),1,1))
      {
        
      OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,txComment,MagicNumber);
    
      }
      else if (iOpen(Symbol(),1,0) > iClose(Symbol(),1,1)) 
      {
      OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,txComment,MagicNumber);
     

     }


And now I confuse how To Close The Order When The New Candle is Appear..


Thanks Before..

 

Try looking. Search for "New Bar".

https://www.mql5.com/en/search

 
ti63r_fx:

Thank's For your Answer..


And now I confuse how To Close The Order When The New Candle is Appear..

 

Use SRC button  for displaying source code 

 

many examples how to close a selected trade

if you open trades with this condition

 if ( iOpen(Symbol(),1,0) < iClose(Symbol(),1,1)) 

 then i think this guy has much to learn.....

Understand this  View code  or see  View   make time for learning 

so for closing trades do an attempt show it so we see and can help where you fail 

Reason: