costume candle close help neede - page 2

 

thanks gooly for you reply  

 but i have no clue what u mean by ( see the reference)

and i like to work on this part  (Check For Close Short Or Long Signal) for now

step by step im not that good or lets say i'm newby in mql4 coding

//+------------------------------------------------------------------+
//| Check For Close Short Or Long Signal                             |
//+------------------------------------------------------------------+
void CloseSignal()
{
      if(OrdersTotal()>1)
      sellcl=false;
      buycl=false;
      double CC1=iClose(NULL, 0,1);
      double profit= OrderProfit();
      if(CC1&&profit>10)sellcl=true;
      if(CC1&&profit>10)buycl=true;
}

 I'm trying to close a trade when in profit if the candel closes in profit, but profit needs to be at 10*Points

is it closing smaller then 10*Points keep it open.

i thing you try to have me to look at the documentation  if you have link it would help

i'm not asking to code for me

thanks 

 
The editor's option: Help => MQL4 Reference. Click on the tab Index and enter just Order+Enter. There you can read everting you need to code what you want!
 

are we getting somewhere? i'm not sure

 

//+------------------------------------------------------------------+
//| Check For Close Short Or Long Signal                             |
//+------------------------------------------------------------------+
void CloseSignal()
{
      if(OrdersTotal()>1)
      if(OrderSelect(11111,SELECT_BY_TICKET)==true)
      sellcl=false;
      buycl=false;
      double CC1=iClose(NULL, 0,1);
      double profit= OrderProfit();
      if(CC1&&profit>10)sellcl=true;
      if(CC1&&profit>10)buycl=true;
}
 

me neither, but you are getting closer, I am sure.

At least one thing is missing, guess what I mean ;)

 
return; was missing?????
//+------------------------------------------------------------------+
//| Check For Close Short Or Long Signal                             |
//+------------------------------------------------------------------+
void CloseSignal()
{
      if(OrdersTotal()>1)
      if(OrderSelect(11111,SELECT_BY_POS,MODE_TRADES)==true)
      sellcl=false;
      buycl=false;
      double CC1=iClose(NULL, 0,1);
      double profit= OrderProfit();
      if(CC1&&profit>10)sellcl=true;
      if(CC1&&profit>10)buycl=true;
      return;
}
 
no - cold ;)
 
I give you a hint, there is  the EA "Moving Average.mq4" (a mt4 example of an EA) look at its order management and just copy, paste, and change this for your needs.
 

hi there!

so i got the closing done it works and has no errors by the compiling

int start()
{
      bool resOS,resOC;

      resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE);
      resOC=OrderClose(OrderTicket(),OrderLots(),Ask, 3);//close
return(0);

 it closed long or short position

question? it only closes first in the pool, i mean the 0 in the OrderSelect, is first in the pool 

first current open order in the pool will be closed 

im right here??

and thanks for u help 

 

Not you know what OrderSelect(..) returns, why, and what you can do with it? Same with OrderClose().

It's all in "Moving Average.mq4"!!

 
int start()
{
      bool resOS,resOC;
      resOS=OrderSelect(0,SELECT_BY_POS,MODE_BASE);
      if(OrderProfit()>15*Point)
      resOC=OrderClose(OrderTicket(),OrderLots(),Ask, 3);
return(0);

hi there! that code works close trades around 15*Points no errors compiling

now i have it that far works like tp. I need an other push from u dont know how to caculate the candle

close trade at candle close if it is more then 15* in profit

profit solved but candle dont know where to start

i belive is not iClose or iBar

so please help but not coding for me

thanks a lot 

Reason: