+ Reply to Thread
Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Close of candle system

  1. #1
    Junior Member
    Join Date
    Dec 2008
    Posts
    11

    Default Close of candle system

    Hey Funyoo,

    I was trying to code an EA by inserting the following main signal in your EA system. I hope I am not infriging too much on your rights.

    The problem is I want the EA to close any open trade at the end of the candle even if the trade does not reach take profit .

    Is it possible to suggets how one may acheive this with your EA system.

    Or use my main signal to produce an EA so others may try it out. It shows good potential on 30M or H1 with the proper stoploss.

    Thanks,

    inkuumba


    //main signal
    string SBUY="false";string SSEL="false";
    bool buy= Open[1]-Close[1]>0&&High[1]-Low[1]>=15*Point&&Bid >= Close[1]+SignalPips*Point &&
    Bid <= Close[1]+SignalPips*Point+Slippage*Point&&Low[0]<=Low[1]&&High[0]<Close[1]+(Slippage+SignalPips)*Point&&MathAbs(Close[1]-Open[0])<Slippage*Point;
    bool sell= Close[1]-Open[1]>0&&High[1]-Low[1]>=15*Point&&Bid <= Close[1]-SignalPips*Point &&
    Bid >= Close[1]-SignalPips*Point-Slippage*Point&&High[0]>=High[1]&&Low[0]>Close[1]-(Slippage+SignalPips)*Point&&MathAbs(Close[1]-Open[0])<Slippage*Point;
    if(buy)SBUY="true";
    if(sell)SSEL="true";

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,455

    Default

    Quote Originally Posted by inkuumba View Post
    Hey Funyoo,

    I was trying to code an EA by inserting the following main signal in your EA system. I hope I am not infriging too much on your rights.
    Hi inkuumba,

    No pb, as long as you don't erase the header (of course you can add "modified by inkuumba") and you don't sell it.

    Quote Originally Posted by inkuumba View Post
    The problem is I want the EA to close any open trade at the end of the candle even if the trade does not reach take profit .

    Is it possible to suggets how one may acheive this with your EA system.

    Or use my main signal to produce an EA so others may try it out. It shows good potential on 30M or H1 with the proper stoploss.

    Thanks,

    inkuumba


    //main signal
    string SBUY="false";string SSEL="false";
    bool buy= Open[1]-Close[1]>0&&High[1]-Low[1]>=15*Point&&Bid >= Close[1]+SignalPips*Point &&
    Bid <= Close[1]+SignalPips*Point+Slippage*Point&&Low[0]<=Low[1]&&High[0]<Close[1]+(Slippage+SignalPips)*Point&&MathAbs(Close[1]-Open[0])<Slippage*Point;
    bool sell= Close[1]-Open[1]>0&&High[1]-Low[1]>=15*Point&&Bid <= Close[1]-SignalPips*Point &&
    Bid >= Close[1]-SignalPips*Point-Slippage*Point&&High[0]>=High[1]&&Low[0]>Close[1]-(Slippage+SignalPips)*Point&&MathAbs(Close[1]-Open[0])<Slippage*Point;
    if(buy)SBUY="true";
    if(sell)SSEL="true";
    This is a good question.

    I suggest you to close the order with this :

    Code:
    int m,s,k;
    m=Time[0]+Period()*60-TimeCurrent();
    s=m%60;
    m=(m-m%60)/60;
    condition :

    Code:
    (m==0 && s<10)
    It will close the order in the 10 last seconds of the bar before the close.

  3. #3
    Junior Member
    Join Date
    Dec 2008
    Posts
    11

    Default

    Thanks for the bit of code Funyoo. It works

    inkuumba

+ Reply to Thread

Similar Threads

  1. Close all buy and close all sell orders
    By q8m2002 in forum Scripts and other tools
    Replies: 8
    Last Post: 12-17-2010, 05:33
  2. Close Trade
    By abroco in forum Ideas for expert advisors
    Replies: 4
    Last Post: 06-30-2009, 13:39
  3. Close all open trades after every x profit
    By begu in forum MQL programming
    Replies: 1
    Last Post: 04-09-2009, 18:03
  4. How to close open orders?
    By juhanimi in forum MQL programming
    Replies: 0
    Last Post: 03-05-2009, 07:49
  5. Close Specific Trade Positions
    By jimhook_uk1 in forum MQL programming
    Replies: 5
    Last Post: 02-17-2009, 19:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts