stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

open/close cross ea
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=27
Page 2 of 3
Author:  SteveHopwood [ Fri Nov 18, 2011 1:37 pm ]
Post subject:  Re: open/close cross ea

gaheitman wrote:Is it worth putting explicit deletes in when the bot closes trades on it's own?

Code: Select all

bool CloseTrade(int ticket)
{   
   while(IsTradeContextBusy()) Sleep(100);
   bool result = OrderClose(ticket, OrderLots(), OrderClosePrice(), 1000, CLR_NONE);

   //Actions when trade send succeeds
   if (result)
   {
      ObjectDelete(SlPrefix + DoubleToStr(ticket, 0));
      ObjectDelete(TpPrefix + DoubleToStr(ticket, 0));
      return(true);
   }//if (result)
   
   //Actions when trade send fails
   if (!result)
   {
      return(false);
   }//if (!result)
   

}//End bool CloseTrade(ticket)
BTW, quick work updating the code to make sure there were lines in the first place!

George


See if this works.

:D
Yes, it is. I was just being lazy.

:D
Author:  SteveHopwood [ Fri Nov 18, 2011 1:42 pm ]
Post subject:  Re: open/close cross ea

jiva34 wrote:stop lines on chart are not aprobloem now.
But it looks like the stop reverse function is not always working.
screenshot shows 2 times a short did not open when a buy was stopped out on a reverse signal..
I knew what the problem is as soon as I read your post.

This should solve it.

:D
Author:  tex [ Fri Nov 18, 2011 2:07 pm ]
Post subject:  Re: open/close cross ea

Jiva,

which MA settings do you use for this bot ?

thanks
jiva34 wrote:stop lines on chart are not aprobloem now.
But it looks like the stop reverse function is not always working.
screenshot shows 2 times a short did not open when a buy was stopped out on a reverse signal..
Author:  jiva34 [ Fri Nov 18, 2011 2:27 pm ]
Post subject:  Re: open/close cross ea

??????????????????
Am testing a number of settings.
Looks like 34, method 6 for the open/close cross
and a slower ma for the trend.
Looking at 144, method 2.
On a 15 minute chart for EURUSD.
no trailing stops, be 25 move, 5 pips
Basically whatever works...
Author:  jiva34 [ Fri Nov 18, 2011 2:39 pm ]
Post subject:  Re: open/close cross ea

SteveHopwood wrote:
jiva34 wrote:stop lines on chart are not aprobloem now.
But it looks like the stop reverse function is not always working.
screenshot shows 2 times a short did not open when a buy was stopped out on a reverse signal..
I knew what the problem is as soon as I read your post.

This should solve it.

:D
not opening trades at all........
Author:  SteveHopwood [ Fri Nov 18, 2011 2:46 pm ]
Post subject:  Re: open/close cross ea

jiva34 wrote:
SteveHopwood wrote:
jiva34 wrote:stop lines on chart are not aprobloem now.
But it looks like the stop reverse function is not always working.
screenshot shows 2 times a short did not open when a buy was stopped out on a reverse signal..
I knew what the problem is as soon as I read your post.

This should solve it.

:D
not opening trades at all........
No reason why it shouldn't - and it is in a backtest, both the initial trade and s&r.

:D
Author:  jiva34 [ Fri Nov 18, 2011 3:08 pm ]
Post subject:  Re: open/close cross ea

not opening anything..
settings are the same as for the previous version which did open and close
but didn't open the shorts when the buys stopped out.
??
Author:  Gamma_gallus [ Fri Nov 18, 2011 5:55 pm ]
Post subject:  Re: open/close cross ea

I'm running an optimization with following variables (EURUSD M15).
I'll post the results in a couple of hours when it's done.
After I'll demo some of the different settings on a forward testing to assess the optimization quality (can't really rely on it - quite often)

FastMaPeriod
FastMaMethod
FastMaAppliedPrice
SlowMaPeriod
SlowMaMethod
SlowMaAppliedPrice
Author:  gaheitman [ Fri Nov 18, 2011 6:43 pm ]
Post subject:  Re: open/close cross ea

It's opening trades in ST for me as well. Are you downloading the one from the first post, it has a version 5 identifier.

George
jiva34 wrote:not opening anything..
settings are the same as for the previous version which did open and close
but didn't open the shorts when the buys stopped out.
??
Author:  Gamma_gallus [ Fri Nov 18, 2011 7:22 pm ]
Post subject:  Re: open/close cross ea

Here attached the optimization file (EURUSD M15) variables are in red.
I'll test few versions, will see which ones over the weekend.
All times are UTC Page 2 of 3