Awesome + SS version

The place for Peaky and Peaky-related stuff.
Post Reply
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Awesome + SS version

Post by SteveHopwood »

c1borg, I have solved the lot size thingy - I have been meaning to do this for years as it applies to every EA I ever coded that uses this feature.

Change line 476 from a double to an integer:
int SizeOfDollop=1000;

Then copy this over the top of the existing void CalculateLotAsAmountPerCashDollops():

Code: Select all

void CalculateLotAsAmountPerCashDollops()
{

   double lotstep = MarketInfo(Symbol(), MODE_LOTSTEP);
   int decimal = 0;
   if (CloseEnough(lotstep, 0.1) )
      decimal = 1;
   if (CloseEnough(lotstep, 0.01) )
      decimal = 2;
      
   double maxlot = MarketInfo(Symbol(), MODE_MAXLOT);
   double minlot = MarketInfo(Symbol(), MODE_MINLOT);
   double DoshDollop = AccountInfoDouble(ACCOUNT_BALANCE); 
   
   if (UseEquity)
      DoshDollop = AccountInfoDouble(ACCOUNT_EQUITY); 

//For testing:
//DoshDollop = 2796;
   
   //Calculate the no of dollops in DoshDollop
   int NoOfDollops = (int) DoshDollop / SizeOfDollop;

   
   //Initial lot size
   Lot = NormalizeDouble(NoOfDollops * LotsPerDollopOfCash, decimal);
     
   //Min/max size check
   if (Lot > maxlot)
      Lot = maxlot;
      
   if (Lot < minlot)
      Lot = minlot;      

//For testing
//Alert(DoubleToStr(Lot, decimal));


}//void CalculateLotAsAmountPerCashDollops()
You will see a 'possible loss of data' warning when you recompile. Navigate to the warning and you will see this code:
SizeOfDollop = TradeSizeOfDollop[tfIndex];

It needs to be:
SizeOfDollop = (int) TradeSizeOfDollop[tfIndex];

: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. pianodoodler@hotmail.com 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
c1borg
Trader
Posts: 456
Joined: Sun Aug 14, 2016 5:09 pm

Awesome + SS version

Post by c1borg »

alecsa72 » Fri May 25, 2018 12:21 pm wrote:
Hi c1borg

Which of the 3 EAs attached in your first port are you using this set file with?
I kind of got lost in all back and forth - which one is your current working EA?

Regards
Version 1b in post 1
User avatar
c1borg
Trader
Posts: 456
Joined: Sun Aug 14, 2016 5:09 pm

Awesome + SS version

Post by c1borg »

SteveHopwood » Fri May 25, 2018 4:07 pm wrote:c1borg, I have solved the lot size thingy - I have been meaning to do this for years as it applies to every EA I ever coded that uses this feature.

Change line 476 from a double to an integer:
int SizeOfDollop=1000;

Then copy this over the top of the existing void CalculateLotAsAmountPerCashDollops():

Code: Select all

void CalculateLotAsAmountPerCashDollops()
{

   double lotstep = MarketInfo(Symbol(), MODE_LOTSTEP);
   int decimal = 0;
   if (CloseEnough(lotstep, 0.1) )
      decimal = 1;
   if (CloseEnough(lotstep, 0.01) )
      decimal = 2;
      
   double maxlot = MarketInfo(Symbol(), MODE_MAXLOT);
   double minlot = MarketInfo(Symbol(), MODE_MINLOT);
   double DoshDollop = AccountInfoDouble(ACCOUNT_BALANCE); 
   
   if (UseEquity)
      DoshDollop = AccountInfoDouble(ACCOUNT_EQUITY); 

//For testing:
//DoshDollop = 2796;
   
   //Calculate the no of dollops in DoshDollop
   int NoOfDollops = (int) DoshDollop / SizeOfDollop;

   
   //Initial lot size
   Lot = NormalizeDouble(NoOfDollops * LotsPerDollopOfCash, decimal);
     
   //Min/max size check
   if (Lot > maxlot)
      Lot = maxlot;
      
   if (Lot < minlot)
      Lot = minlot;      

//For testing
//Alert(DoubleToStr(Lot, decimal));

}//void CalculateLotAsAmountPerCashDollops()
You will see a 'possible loss of data' warning when you recompile. Navigate to the warning and you will see this code:
SizeOfDollop = TradeSizeOfDollop[tfIndex];

It needs to be:
SizeOfDollop = (int) TradeSizeOfDollop[tfIndex];

:xm: :rocket:
Nice work much appreciated I will put a new version in post 1 :clap:
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Awesome + SS version

Post by SteveHopwood »

I attach V 1c. It includes the fix I described above.

There are now 4 time frame SS inputs. The code takes these and places them in arrays for ease of typing later on - starting at line 184. void PopulateTheArrays() sizes them - scroll down to the bottom of the function.

void ReadAndCalculateSuperSlope(string symbol, int pairsIndex) fills the arrays. It is called at line 4147. I have introduced two new variables, SsAlignedLong/Short. These are only left set to 'true' if all selected SS tf's match up. They are part of the trading decision starting at line 4248.

The variables SsAlignedLong/Short are set on each iteration and then discarded. They may need to become arrays themselves, depending on what you want to do about lines 2202 and 2226 which you will see are commented out. Extra coding will be needed if any combination of SS is required to close trades, so have a look and let me know what you think.

There is as much a chance of Gracie concentrating through an entire term's worth of piano lessons as there is of all this being bug free, so pop it on demo and sing out when the gremlins appear. First thingy to do is to check that the SS readings are correct. Frankly, this turned out to be more complicated than I first thought and it took a long time; I cannot be arsed to do the checks.

:xm: :rocket:
You do not have the required permissions to view the files attached to this post.
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. pianodoodler@hotmail.com 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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Awesome + SS version

Post by SteveHopwood »

I forgot to add that you need to cancel the spread and rollover features so the bot can display all pairs' SS values over the weekend. They will be left blank if you do not do 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. pianodoodler@hotmail.com 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
c1borg
Trader
Posts: 456
Joined: Sun Aug 14, 2016 5:09 pm

Awesome + SS version

Post by c1borg »

Quick update I have updated post 1 with the new version and some other tweaks.

I dont usually trade on holidays because of the very thin volume but forgot to stop the V3 demo and guess what closed the basket with a good profit today :yahoo: My live account however was off. I will start a new demo with the 1c version and report back any bugs I find, thanks Steve :hi:
User avatar
c1borg
Trader
Posts: 456
Joined: Sun Aug 14, 2016 5:09 pm

Awesome + SS version

Post by c1borg »

Does anyone know how to reset these variables?
Capture1.png
Why you may ask? Well my live account wasnt traded today and therefore if started it will immediately start looking for a profit and opening trades today, because the daily profit condition isnt met. I dont want the EA to actually start until 00:00am GMT tomorrow as thats when the EA starts every day in my case. So the bad news is I would have to set an alarm to get up and manually start the EA at the correct time. Any ideas on how to solve this would be appreciated?
You do not have the required permissions to view the files attached to this post.
chrisdk2018
Trader
Posts: 37
Joined: Tue Jun 07, 2016 10:18 am

Awesome + SS version

Post by chrisdk2018 »

c1borg » Mon May 28, 2018 12:30 pm wrote:Does anyone know how to reset these variables?



Why you may ask? Well my live account wasnt traded today and therefore if started it will immediately start looking for a profit and opening trades today, because the daily profit condition isnt met. I dont want the EA to actually start until 00:00am GMT tomorrow as thats when the EA starts every day in my case. So the bad news is I would have to set an alarm to get up and manually start the EA at the correct time. Any ideas on how to solve this would be appreciated?
Set the trading hours in the input.

I had the same problem, because as you had found out the main profits come from the Asian session - in the night for Europeans.
User avatar
c1borg
Trader
Posts: 456
Joined: Sun Aug 14, 2016 5:09 pm

Awesome + SS version

Post by c1borg »

chrisdk2018 » Mon May 28, 2018 12:33 pm wrote:
Set the trading hours in the input.

I had the same problem, because as you had found out the main profits come from the Asian session - in the night for Europeans.
I hear what you say but how do I set the time for tomorrow? as we are still in today until 24:00? So whatever time I set it will begin trading.
nicolkoekoek
Trader
Posts: 72
Joined: Tue Mar 11, 2014 4:27 pm
Location: De Bilt

Awesome + SS version

Post by nicolkoekoek »

The way I understand the - Trading hours - settings:
If you want to have the EA to start trading every day at 8AM server time, and to stop making new entries at, let's say 22:15 server time, then you just add in the TradingHours line: +08.00,22.15

If your server time is still before that end time today(the 22:15), and you would enter it now it would take the trades till 22:15 server time. So if you want to start tomorrow at 8 am only then you could just put in temporary time that has already past today, as example : +08.00,12.00
(with having a current server time > 12.01)

In this way it should not open any trades anymore today. Of course you should change it tomorrow morning again to a preferred end time, before 12 am to keep it going.... :)
Post Reply

Return to “Peaky forum”