Slopey Peaky Bob

Post Reply
Dragonian

Slopey Peaky Bob

Post by Dragonian »

SteveHopwood » 07 Feb 2019 10:29 wrote:
Done. Post 1 as usual.
Thank you Steve :hi:
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.

Slopey Peaky Bob

Post by SteveHopwood »

Mauro spotted one of my copy-paste-forget to edit bloops in the shirt protection function is the Latest version. I have uploaded a fix to post 1.

DIY: do a search for, "//Close the entire position if we are in danger of a margin call." You will see this three lines down:
if (ml < DeletePendingsBelowThisMarginLevelPercent)

Change it to:
if (ml < CloseDeleteAllBelowThisMarginLevelPercent)

: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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Slopey Peaky Bob

Post by SteveHopwood »

Latest V 2a is in post 1, with a fix for the problem described in Mauro's pm to me this morning:
Hello Steve.

I found one of my demo running SPB latest version in an endless loop, opening and closing pendings.
Margin was below the threshold so ShirtProtection kicked in but I think LookForTradingOpportunities that gets called right after creates the pendings again.
This probably applies to Desky as well, but I will look at that later.

Easy DIY. Go to, "bool IsTradingAllowed(string symbol, int PairIndex)" and add this code block:

Code: Select all

   //Margin level
   if (!CloseEnough(AccountMargin(), 0) )
   {
      double ml = NormalizeDouble(AccountEquity() / AccountMargin() * 100, 2);
      if (ml < DeletePendingsBelowThisMarginLevelPercent || ml < CloseDeleteAllBelowThisMarginLevelPercent)
         return(false);   
   }//if (!CloseEnough(AccountMargin(), 0) )
 
Thanks Mauro. :clap: :clap: :clap: :clap: :clap:

: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
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Slopey Peaky Bob

Post by SteveHopwood »

SPB Latest V 2c is in post 1.

I have added a new feature to grid trading. This is the option to use the order open price of the next trade in the grid as the take profit of the one being sent to the server. The input is UseNextLevelForTP.

This is a simple DIY. Do a search for this variable, "extern double GridAtrDivisor". Insert this code underneath:

Code: Select all

extern string  gtp="-- Grid trades take profit --";
//This tells Desky to set the take profit for each trade at the open price of the next trade in the grid.
extern bool    UseNextLevelForTP=false;
Go to void SendBuyGrid(string symbol,int type,double price,double lot,string comment). Scroll down the this line of code:
take = CalculateTakeProfit(OP_BUY, price);

Replace it with this block:

Code: Select all

      if (!UseNextLevelForTP)
         take = CalculateTakeProfit(OP_BUY, price);
      if (UseNextLevelForTP)//Set the tp at the open price of the next trade
         take = price;
Go to void SendSellGrid(string symbol,int type,double price,double lot,string comment) - it is the next function in the file. Scroll down to this line of code:
take = CalculateTakeProfit(OP_SELL, price);

Replace it with this block:

Code: Select all

      if (!UseNextLevelForTP)
         take = CalculateTakeProfit(OP_SELL, price);
      if (UseNextLevelForTP)//Set the tp at the open price of the next trade
         take = price;
: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.
billv
Trader
Posts: 283
Joined: Fri Apr 13, 2012 1:57 pm

Slopey Peaky Bob

Post by billv »

Many thanks Steve, will give it a test :hi:
billv
Trader
Posts: 283
Joined: Fri Apr 13, 2012 1:57 pm

Slopey Peaky Bob

Post by billv »

Hi Steve

Is this code only meant to place TP on the 1st grid of 5 orders?

Regards
Bill
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.

Slopey Peaky Bob

Post by SteveHopwood »

Mauro spotted a logic bloop in the code that sets grid trades take profit at the open price of the next trade. Thanks again Mauro. :clap: :clap: :clap: :clap: :clap:

Fixed in post 1. A DIY is easy. Do a search for, "//Set the tp at the open price of the next trade". The next line of code is:
take = price;

This needs replacing with:
take = NormalizeDouble(price + (DistanceBetweenTrades/factor), digits);

Repeat the search and you will land in the function that sends sell grids. The next line of code will again be:
take = price;

This needs replacing with:
take = NormalizeDouble(price - (DistanceBetweenTrades/factor), digits);

: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.
barry
Trader
Posts: 81
Joined: Thu Mar 01, 2012 5:12 am

Slopey Peaky Bob

Post by barry »

billv » Sun Feb 03, 2019 7:10 am wrote:
SteveHopwood » Sun Feb 03, 2019 5:56 am wrote: There is one more input allowing the user to chose his/her own lot size but retains Thomas' simplicity. :
The following example is from my $60K AUD account with settings: riskpercent=2 and stoploss =2000.
Currently the account does not have open EURGBP trades but if there were any, they would have been size 0.02.
This technique is not only helping me reduce my DD, but it also makes my money work harder because currency pairs which have low pip value can be traded at higher lot size.

I hope this helps someone :)
billv, this looks like a nice idea, thanks for posting it. Do you have this account on FXTestify or anywhere else it can be followed? I would like to look at the results more closely, thanks.
billv
Trader
Posts: 283
Joined: Fri Apr 13, 2012 1:57 pm

Slopey Peaky Bob

Post by billv »

barry » Tue Feb 19, 2019 8:19 pm wrote:
billv, this looks like a nice idea, thanks for posting it. Do you have this account on FXTestify or anywhere else it can be followed? I would like to look at the results more closely, thanks.
Hi Barry

I believe it is essential for this type of trading and we can thank Thomas for putting in this code.
I cannot participate with this account in fxtestify because it is live and I intervene manually (closing and adding new orders).

You can experiment with these settings and see what works for you.
Lot=0
LotsPerDollopOfCash=0
RiskPercent=2
SL=1400 ( try higher or lower SL and see what lot size you get)

As a general rule, I would let the pairs which have the highest pip value be traded at the minimum size (0.01) and I would let the others be traded at 0.02, 0.03 etc

I have now set some of my test accounts to 2% and 1400, and others to 2.5% and 1400
These settings work for my AUD account and they would be different for a different base currency but in my opinion we don't need surgical precision.
We only want to balance our trade size so that a 1 pip move would have approximately the same impact on any traded pair. This would help reduce our DD.
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.

Slopey Peaky Bob

Post by SteveHopwood »

I have written a do it yourself for beginners guide. http://www.stevehopwoodforex.com/phpBB3 ... 92#p166292

: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.
Post Reply

Return to “Super Slope EA's”