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

Awesome + SS version
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5447
Page 18 of 40
Author:  SteveHopwood [ Fri May 25, 2018 4:07 pm ]
Post subject:  Awesome + SS version

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:
Author:  c1borg [ Sat May 26, 2018 6:39 am ]
Post subject:  Awesome + SS version

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
Author:  c1borg [ Sat May 26, 2018 7:11 am ]
Post subject:  Awesome + SS version

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:
Author:  SteveHopwood [ Sat May 26, 2018 8:29 pm ]
Post subject:  Awesome + SS version

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:
Author:  SteveHopwood [ Sat May 26, 2018 9:15 pm ]
Post subject:  Awesome + SS version

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:
Author:  c1borg [ Mon May 28, 2018 12:20 pm ]
Post subject:  Awesome + SS version

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:
Author:  c1borg [ Mon May 28, 2018 12:30 pm ]
Post subject:  Awesome + SS version

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?
Author:  chrisdk2018 [ Mon May 28, 2018 12:33 pm ]
Post subject:  Awesome + SS version

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.
Author:  c1borg [ Mon May 28, 2018 3:36 pm ]
Post subject:  Awesome + SS version

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.
Author:  nicolkoekoek [ Mon May 28, 2018 4:45 pm ]
Post subject:  Awesome + SS version

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.... :)
All times are UTC Page 18 of 40