Download MetaTrader 5

costume candle close help neede

To add comments, please log in or register
PieroNetto
189
PieroNetto  
hi everyone!!! i trying to code a closing condition. When there is an open position and candle is closing in profit bigger then 10*points close trade. i try to attach the code with src but i only get attachment option. it says it right there to use src , cant see any bottom for it. as u see i have two problems to solve and asking for help thanks //+------------------------------------------------------------------+ //| 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; } //+------------------------------------------------------------------+ //| Check For Close Condition | //+------------------------------------------------------------------+ void CloseConditon() { int res; if(buycl) { res = CloseOrder(OP_BUY); } if(sellcl) { res = CloseOrder(OP_SELL); } return; } //+------------------------------------------------------------------+ //| Close Long Or Short Order | //+------------------------------------------------------------------+ int CloseOrder(int mode) { if (OrdersTotal()
whroeder1
15304
whroeder1  
pieronetto: i try to attach the code with src but i only get attachment option.
SRC works fine.
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. //+------------------------------------------------------------------+ 
    //| 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; 
    } 
    //+------------------------------------------------------------------+ 
    //| Check For Close Condition | 
    //+------------------------------------------------------------------+ 
    void CloseConditon() { 
       int res;
       if(buycl){res = CloseOrder(OP_BUY);}
       if(sellcl){res = CloseOrder(OP_SELL);} 
       return; 
    } 
    //+------------------------------------------------------------------+
    //| Close Long Or Short Order | 
    //+------------------------------------------------------------------+ 
    int CloseOrder(int mode) {
       if (OrdersTotal()

  3. Don't double post
PieroNetto
189
PieroNetto  
im sure src works fine but all i have is the browse option on the end of this page how i open the box with the src button like u show my in image 1, or i missing updates i dont have any of this if i go to add new topic i have the subjet line and the big box for text and browse for attachment sorry need more advice on that topic thanks
whroeder1
15304
whroeder1  
pieronetto:all i have is the browse option on the end of this page

What are you talking about? It's right below your post. Do you have Javascript disabled in your browser?


PieroNetto
189
PieroNetto  
WHRoeder:
SRC works fine.

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.


  2. Don't double post

sorry about double posting

and i needed a update on the explorer

everything works finenow

i will try to show the code in a bit 

PieroNetto
189
PieroNetto  

Lets try that again.

hi everyone!!!

i trying to code a closing condition.

When there is an open position and candle is closing in profit bigger then 10*points close trade. 
PieroNetto
189
PieroNetto  
so now i paste the code twice and is not there?????????
PieroNetto
189
PieroNetto  
src still not working
PieroNetto
189
PieroNetto  
last try
//+------------------------------------------------------------------+
//| 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;
}
//+------------------------------------------------------------------+
//| Check For Close Condition                                        |
//+------------------------------------------------------------------+
void CloseConditon()
{    
     int res;
     if(buycl)
     {
     res = CloseOrder(OP_BUY);
     }
     if(sellcl)
     {
     res = CloseOrder(OP_SELL);
     }
return;
}
//+------------------------------------------------------------------+
//| Close Long Or Short Order                                        |
//+------------------------------------------------------------------+
int CloseOrder(int mode)
{
     if (OrdersTotal()<1)
     if (mode==OP_BUY)
      {
      RefreshRates();
      OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits), 3);
      }
      if(mode==OP_SELL && OrderType()==OP_SELL)
 
      {
      RefreshRates(); 
      OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),3);
      }
      return(0);
}

i pasted it in the box click insert

clicking add your comment
PieroNetto
189
PieroNetto  

there it is. finaly got it to work

need help with  Check For Close Short Or Long Signal

what im trying to do is when candle closed in profit min 10*Points close trade

 thats what i have so far still learning 

Carl Schreiber
6968
Carl Schreiber  

You have to select your order (2 options, see the reference) and check the either OrderClosePrice-OrderOpenPrice or OrderProfit()..

It's all in the reference! Have look!

123
To add comments, please log in or register