My shell EA code

DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

My shell EA code

Post by DigitalCrypto »

Hey Steve,

I am working on an idea that incorporates your latest shell non-grid code. I'm using the "don't trade during rollover" settings. In the AreWeAtRollover() function I found a small problem for me and anyone not running this on Queen's time. I changed this as everything else (trading hours etc) seems to point to local time and this was the only change needed.


Original (Broker Time)

Code: Select all

ltime=TimeHour(TimeCurrent())*60+TimeMinute(TimeCurrent());
Modified (Local Time)

Code: Select all

ltime=TimeHour(TimeLocal())*60+TimeMinute(TimeLocal());
- David
User avatar
tomele
Administrator
Posts: 1166
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

My shell EA code

Post by tomele »

High DC.

Basically it is better to use server time here. Rollover happens at server time 00:00 (GMT +2 or +3 depending on whether daylight savings time is in effect or not) for all 5-day-candle brokers (which are nearly all), independent from local time. This way 99% of all users can leave that at default. Using local time would mean every user had to figure out and change this.

Just saying.

Cheers
Thomas
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

My shell EA code

Post by DigitalCrypto »

Hey Thomas,

No problem. I had not taken into consideration the "American" offset nonsense.

-David
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

My shell EA code

Post by DigitalCrypto »

In CalculateLotAsAmountPerCashDollops()


This doesn't. But is it more or less correct?

Code: Select all

Lot = NormalizeDouble(MathFloor(((DoshDollop / SizeOfDollop) * LotsPerDollopOfCash) * 100) / 100), decimal);
Thanks
- David

How would I know? Gerbils have a greater mathematical understanding than me.

I just played with this:

Code: Select all

   double DoshDollop = 2999;
   double  LotsPerDollopOfCash=0.01;
   double  SizeOfDollop=1000;
   int decimal = 5;
   
   double Lot = NormalizeDouble((MathFloor(((DoshDollop / SizeOfDollop) * LotsPerDollopOfCash) * 100) / 100), decimal);
   Alert(Lot);
 
It gave the correct value of 0.02. I did have to add an extra left bracket to make it compile.

I will add it to the shells later. Thanks David.

:xm: :rocket:
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

My shell EA code

Post by SteveHopwood »

David, it looks as though I accidentally edited your post instead of quoting then replying. Sorry about that.

You will see that I have adopted your solution in my Desky and SPB posts.

:xm: :rocket:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

My shell EA code

Post by DigitalCrypto »

That's ok. I'm happy that I could contribute something back.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

My shell EA code

Post by DigitalCrypto »

I noticed yesterday that the trade management module wasn't firing during the rollover window. I added a call to CountOpenTrades() in the Rollover check of the main loop. This seems to have cured my problem.

Code: Select all

   //Rollover
   if (DisableEaDuringRollover)
   {
      RolloverInProgress = false;
      if (AreWeAtRollover())
      {
         RolloverInProgress = true;
         CountOpenTrades(); //Make sure we manage any open trades during this time.
         DisplayUserFeedback();
         return;
      }//if (AreWeAtRollover)
   }//if (DisableEaDuringRollover)
-David
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

My shell EA code

Post by SteveHopwood »

DigitalCrypto » Wed Apr 10, 2019 8:42 pm wrote:I noticed yesterday that the trade management module wasn't firing during the rollover window. I added a call to CountOpenTrades() in the Rollover check of the main loop. This seems to have cured my problem.

Code: Select all

   //Rollover
   if (DisableEaDuringRollover)
   {
      RolloverInProgress = false;
      if (AreWeAtRollover())
      {
         RolloverInProgress = true;
         CountOpenTrades(); //Make sure we manage any open trades during this time.
         DisplayUserFeedback();
         return;
      }//if (AreWeAtRollover)
   }//if (DisableEaDuringRollover)
-David
It isn't a problem David. It is a deliberate strategy. Invoking management at a time when spreads widen dramatically is a bad idea and I strongly advise against doing so.

:xm: :rocket:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
tomele
Administrator
Posts: 1166
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

My shell EA code

Post by tomele »

Hi David.

I put it a bit on the blunt side.

Only a complete idiot does anything during rollover. Even the cheapest bucket shop warns to do so. The market is non-existent then and you will get the weirdest quotes. You may ignore this on a demo account, but you will definitely get slaughtered on a live account.

For years now, every SHF EA does its best to keep you from stepping into this beginners trap. Lots of experience, thinking and coding went into that tiny aspect. You think you are better off ignoring all that?

Well, it is your money.

Thomas
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

My shell EA code

Post by DigitalCrypto »

I understand why you guys have it like that. It makes sense. I had expanded that window to several hours to avoid rates and Fed after hours nonsense. Most of the time I am in profit long before rates. It just wasn't firing. I will make a note on my side.

Thanks
David
Post Reply

Return to “Coders Hangout”