How to Trade 10.x Like a Boss

This is where Bob posts his own threads
Post Reply
andygrope
Trader
Posts: 18
Joined: Mon May 27, 2013 10:11 pm
Location: Adelaide, South Australia

Re: How to Trade 10.x Like a Boss

Post by andygrope »

garyfritz wrote:
spotdespot wrote:I actually think that the issue is with the indicators themselves - or more accurately Empty4 and how it deals with indis. I think (Baluda/Steve/coders please advise) that indicators do whatever it is they do every tick (and presumably cannot do their thing every bar close like an EA can).
That's right. Empty4 calls the start() function on every tick. Most indicators (including the 10.5 CSS indicators) do all their calculations and displays on every tick.

But it's easy to fix. Just add this at the beginning of start():

Code: Select all

datetime LastUpdate = 0;
if (TimeCurrent() - LastUpdate < 10) return(0);
LastUpdate = TimeCurrent();
(Not tested since the markets are closed, but it's pretty trivial.)

That will update every 10 seconds. Change the 10 to 60 if you want it to update every minute.
I have 16 GB and I never get close to using it all and each Empty4 terminal maxes out at around 8% cpu when it is bogged down.
More likely it's 12%. You have a quad-core CPU, with each core having two "threads." So your CPU power gets divided into 8 chunks. 1/8 of 100% is 12.5%. When one CPU is spinning as fast as it can, due to a loop or a hang in Empty4, it only consumes 12.5% of your total CPU.
Hi Gary.
Could you please explain in a bit more detail for a newbie how to get that code operating.
Where is "beginning of start"?
Cheers
User avatar
kwanann
Trader
Posts: 948
Joined: Thu Nov 29, 2012 1:53 am

Re: How to Trade 10.x Like a Boss

Post by kwanann »

The start() function....
I've been trading using OM Dual N EA for the past 2 years, live results can be found over at https://www.fxblue.com/users/kwanann
spotdespot
Trader
Posts: 768
Joined: Sun Jan 22, 2012 11:38 pm

Re: How to Trade 10.x Like a Boss

Post by spotdespot »

Here are some options for people. I have made the change in all the indis that 10.4/10.5 uses that use TMA - I think! If you want to to directly replace what you have then you will need to rename them and overwrite & restart Empty4. I suggest you check that they work first - as Gary mentioned they can't be tested, in terms of effect, with the market closed.

Cheers,
Dave.

EDIT: Updated to add the 10.5 CSS H4 indi
EDIT: - Updated to move the LastUpdate as per the posts below. 24/06/2013 08:35 GMT
You do not have the required permissions to view the files attached to this post.
Last edited by spotdespot on Mon Jun 24, 2013 8:38 am, edited 2 times in total.
garyfritz

Re: How to Trade 10.x Like a Boss

Post by garyfritz »

Yes Shelley, you've got it in the right place -- as does Dave in the zip file above. Dave, you might want to include the 10.5 CSS H4 variant too...
spotdespot
Trader
Posts: 768
Joined: Sun Jan 22, 2012 11:38 pm

Re: How to Trade 10.x Like a Boss

Post by spotdespot »

garyfritz wrote:Yes Shelley, you've got it in the right place -- as does Dave in the zip file above. Dave, you might want to include the 10.5 CSS H4 variant too...
Good spot - done.

Cheers,
Dave.
Pipstubborn
Trader
Posts: 272
Joined: Thu Jul 12, 2012 5:17 pm

Re: How to Trade 10.x Like a Boss

Post by Pipstubborn »

Thanks a lot guys, will try it as son as the market opens. I hope I can see it with all the charts open
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: How to Trade 10.x Like a Boss

Post by fxozgirl »

garyfritz wrote:Yes Shelley, you've got it in the right place -- as does Dave in the zip file above. Dave, you might want to include the 10.5 CSS H4 variant too...

Cheers Gary :D & thanks Dave
mpetersrx7
Posts: 9
Joined: Tue Apr 30, 2013 4:25 pm

Re: How to Trade 10.x Like a Boss

Post by mpetersrx7 »

Shelley.
I don't think this will work because you need to move
datetime LastUpdate = 0;

above the function so it gets defined globally. Otherwise, everytime start is called it gets reset to 0.

HTH,
Mark
fxozgirl wrote:
garyfritz wrote: But it's easy to fix. Just add this at the beginning of start():

Code: Select all

datetime LastUpdate = 0;
if (TimeCurrent() - LastUpdate < 10) return(0);
LastUpdate = TimeCurrent();
(Not tested since the markets are closed, but it's pretty trivial.)

That will update every 10 seconds. Change the 10 to 60 if you want it to update every minute.

Gary, can you please confirm I have placed your piece of code in the correct location?

thanks

Shelley

Code: Select all

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
  datetime LastUpdate = 0;
   if (TimeCurrent() - LastUpdate < 10) return(0);
   LastUpdate = TimeCurrent();
   int limit;
   int counted_bars = IndicatorCounted();

   if (counted_bars < 0)  return(-1);
   if (counted_bars > 0)  counted_bars -= 10;

   limit = Bars - counted_bars;

   if ( maxBars > 0 )
   {
      limit = MathMin (maxBars, limit);   
   }   

   int i;
   
   for ( i = 0; i < CURRENCYCOUNT; i++ )
   {
      SetIndexStyle( i, DRAW_LINE, STYLE_SOLID, 2, currencyColors[i] );
   }   

   RefreshRates();
   
   for ( i = limit; i >= 0; i-- )
   {
      int index;
      double diff = 0.0;
      
      ArrayInitialize(currencyValues, 0.0);
bgood
Posts: 9
Joined: Mon Feb 25, 2013 12:33 am
Location: Ontario, Canada

Re: How to Trade 10.x Like a Boss

Post by bgood »

Jemook, I've tried using Easy Order to place pending trades but each time I do I receive a message stating "Invalid Lot Size". Any suggestions?
garyfritz

Re: How to Trade 10.x Like a Boss

Post by garyfritz »

mpetersrx7 wrote:Shelley.
I don't think this will work because you need to move
datetime LastUpdate = 0;
above the function so it gets defined globally. Otherwise, everytime start is called it gets reset to 0.
GACK!! You are absolutely right, Mark. Either move that line outside the function, or declare it as "static datetime". Moving it outside the function is probably simpler/better.

Sorry about that folks!

I'm trying to test out the code to make sure I didn't screw up again, but for some reason my Empty4 is not behaving. I'll test it when I get things working...

EDIT: Seems to work fine. Just put the datetime declaration before the start() function:

Code: Select all

datetime LastUpdate;
int start()
{
   if (TimeCurrent() - LastUpdate < 10) return(0);
   LastUpdate = TimeCurrent();
Post Reply

Return to “Bob's individual forum”