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

Gertje: a hedged grid trader
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=424
Page 13 of 24
Author:  SteveHopwood [ Sun Apr 01, 2012 10:59 pm ]
Post subject:  Re: Gertje: a hedged grid trader

Got it, I think. Fix in post 1 - at least I think it is a fix.

Coders, given that the lot size is now a changeable thingy, then Lot needs te remain permanent. I declared SendLot as a program-wide variable to hold the value of the adapted lot size.

This snippet holds the key:

Code: Select all

void CalculateLotsizeAndProfitTarget()
{
   //Auto lot size, calculated as LotsPerThousandOfBalance per $1000
   SendLot = Lot;
   if (LotsPerThousandOfBalance > 0)
   {
      //Code for rounding down the account balance to bare thousands profided by Garyfritz. Many thanks Gary.
      double BaseMag = MathPow(10, MathFloor(MathLog(AccountBalance()) / MathLog(10))); // 4376.59 -> 1000
      double RoundDown = MathFloor(AccountBalance() / BaseMag) * BaseMag;
      Lot = (RoundDown * 0.1) / 1000;      
   }//if (LotsPerThousandOfBalance > 0)

   //Adaptive take profit
   if (CashProfitPerLot > 0)
   {
      CashProfitTarget = NormalizeDouble(Lot * CashProfitPerLot, 0);
   }//if (CashProfitPerLot > 0)
   
   
   //Users can opt for incrementing the lotsize with each successive trade in the grid
   if (OpenTrades > 0) IncrementLot();

   //Lotsize idiot check
   double MinLot = MarketInfo(Symbol(), MODE_MINLOT);
   double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT);
   if (SendLot < MinLot) Lot = MinLot;
   if (SendLot > MaxLot) Lot = MaxLot;
   

}//End void CalculateLotsizeAndProfitTarget()
The problem is the line:

Code: Select all

Lot = (RoundDown * 0.1) / 1000;      
which leaves SendLot at the value of Lot as it was on load up. This actually needs to be:

Code: Select all

SendLot = (RoundDown * 0.1) / 1000;      
So, non-coders download the fix in post 1. Coders, you know how to make the change.

:D
Author:  SteveHopwood [ Sun Apr 01, 2012 11:19 pm ]
Post subject:  Re: Gertje: a hedged grid trader

Coders, in that code snippet I posted, there are a few more changes to make that I forgot to mention - look at:

Code: Select all

   //Lotsize idiot check
   double MinLot = MarketInfo(Symbol(), MODE_MINLOT);
   double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT);
   if (SendLot < MinLot) Lot = MinLot;
   if (SendLot > MaxLot) Lot = MaxLot;
Bit rich coming from me. Hey ho.

Also, the max pairs trading thingy appears not to work. I will sort that one out tomorrow.

:D
Author:  SteveHopwood [ Sun Apr 01, 2012 11:31 pm ]
Post subject:  Re: Gertje: a hedged grid trader

Oh, Strain a Bicep Playing Chess. I found the reason for the max pairs thingy not working the instant I went looking for it.

Usual thingy. Carefully coded al the prelim stuff - declared the variables, added the chart feed back etc. This can take ages. Then forgot to add the actual filter to the trade decision code.

Can't you guys find a forum to go to where the PCA has a firing brain cell?

Fix in post 1. If it actually fixes anything. Given my record today, I doubt it.

:oops:
Author:  nubika [ Mon Apr 02, 2012 3:17 am ]
Post subject:  Re: Gertje: a hedged grid trader

TehCount wrote:NOTE: These were started with the first version of this EA. The set files may or may not work with the latest version but you can see the effective settings. Trend detection (RSI) was not used on these.

UPDATE: Both killed. Old version of EA and no longer relevant..

Image
gertje.a.set
Image
gertje.b.set

I do not understand how did you manage to get the accounts killed.

I need to look at your set files.

Both of my accounts and the LIVE account as well, made huge gains this morning because of the weekend gap. The EA performed absolutely perfectly. Took all the profits and reopened the grid instantly.

My AUDUSD account now up by 24% and the GBPJPY account is up by 26%

I am also using the original EA and performs like a miracle up until now.

I started a new setup with the latest version, but only looking for the feature which protects the account in ranging conditions and looks for a breakeven amount. Maybe this will never happen, so I might not be able to see if it actually works as well as it is intended.

Frank
Author:  SteveHopwood [ Mon Apr 02, 2012 8:50 am ]
Post subject:  Re: Gertje: a hedged grid trader

Latest update in post 1. Some bugs surfaced in the money management code this morning, so the update is essential if you are using mm.

:D
Author:  blazko [ Mon Apr 02, 2012 9:16 am ]
Post subject:  Re: Gertje: a hedged grid trader

nubika wrote: Both of my accounts and the LIVE account as well, made huge gains this morning because of the weekend gap. The EA performed absolutely perfectly. Took all the profits and reopened the grid instantly.

My AUDUSD account now up by 24% and the GBPJPY account is up by 26%

I am also using the original EA and performs like a miracle up until now.

I started a new setup with the latest version, but only looking for the feature which protects the account in ranging conditions and looks for a breakeven amount. Maybe this will never happen, so I might not be able to see if it actually works as well as it is intended.

Frank
Frank, do you mind posting your current set with pairs/tf info?
My work proxy is loading forum posts for ages and i cant easly search for it. Thank you.
Author:  nubika [ Mon Apr 02, 2012 9:58 am ]
Post subject:  Re: Gertje: a hedged grid trader

blazko wrote:
nubika wrote: Both of my accounts and the LIVE account as well, made huge gains this morning because of the weekend gap. The EA performed absolutely perfectly. Took all the profits and reopened the grid instantly.

My AUDUSD account now up by 24% and the GBPJPY account is up by 26%

I am also using the original EA and performs like a miracle up until now.

I started a new setup with the latest version, but only looking for the feature which protects the account in ranging conditions and looks for a breakeven amount. Maybe this will never happen, so I might not be able to see if it actually works as well as it is intended.

Frank
Frank, do you mind posting your current set with pairs/tf info?
My work proxy is loading forum posts for ages and i cant easly search for it. Thank you.
Blazej,

This is what I am using.

TF is irrelevant, but I use TF 30 min for better visual tracking.

These are still on the first original Gartje EA.

AUDUSD:

Account size: $2000 Current balance as I write this $2504 started on the 19th of March

Lot size: 0.2
Cash profit target: $19
Pips between trades: 25
No of trades : 30
RsiTdApplied Price: 0 The rest is default

Only one pair per account.

GBPJPY:

Account size: $2000 Current balance $2666.20 Started on the 28th of March

Lot size: 0.3
Cash profit target : $43
Pips between trades : 27
No of trades: 30
RsiTdApplied Price: 0 The rest is default

I am also running from today additional accounts with different settings using the latest version of the EA.
EURAUD, EURJPY and AUDJPY

Will report on those later.

Frank
Author:  blazko [ Mon Apr 02, 2012 10:23 am ]
Post subject:  Re: Gertje: a hedged grid trader

Thanks a lot Frank.
I need do wrap my head around chosing profit targets and pips between trades values.
Author:  harry45 [ Mon Apr 02, 2012 10:34 am ]
Post subject:  Re: Gertje: a hedged grid trader

nubika wrote:
blazko wrote:
nubika wrote: Both of my accounts and the LIVE account as well, made huge gains this morning because of the weekend gap. The EA performed absolutely perfectly. Took all the profits and reopened the grid instantly.

My AUDUSD account now up by 24% and the GBPJPY account is up by 26%

I am also using the original EA and performs like a miracle up until now.

I started a new setup with the latest version, but only looking for the feature which protects the account in ranging conditions and looks for a breakeven amount. Maybe this will never happen, so I might not be able to see if it actually works as well as it is intended.

Frank
Frank, do you mind posting your current set with pairs/tf info?
My work proxy is loading forum posts for ages and i cant easly search for it. Thank you.
Blazej,

This is what I am using.

TF is irrelevant, but I use TF 30 min for better visual tracking.

These are still on the first original Gartje EA.

AUDUSD:

Account size: $2000 Current balance as I write this $2504 started on the 19th of March

Lot size: 0.2
Cash profit target: $19
Pips between trades: 25
No of trades : 30
RsiTdApplied Price: 0 The rest is default

Only one pair per account.

GBPJPY:

Account size: $2000 Current balance $2666.20 Started on the 28th of March

Lot size: 0.3
Cash profit target : $43
Pips between trades : 27
No of trades: 30
RsiTdApplied Price: 0 The rest is default

I am also running from today additional accounts with different settings using the latest version of the EA.
EURAUD, EURJPY and AUDJPY

Will report on those later.

Frank

Frank, You mean RSI TF 1440,Per=20,applied price=0.Am I right?
Regards
Author:  nubika [ Mon Apr 02, 2012 11:11 am ]
Post subject:  Re: Gertje: a hedged grid trader

Frank, You mean RSI TF 1440,Per=20,applied price=0.Am I right?
Regards[/quote]


Harry

No, this is what I set up. In other words, I disabled the RSI filter.

RSI TF 1440,
Per=0,
applied price=0

Frank
All times are UTC Page 13 of 24