Moving Day

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

Moving Day

Post by SteveHopwood »

V 1b is in post 1, with a teensy update to the chart information display. I set up four demo accounts this morning and realised how helpful it would be to have the trading method displayed along with the number of pips away from the market the stop orders would be placed. 1b displays this information.

Easy DIY. D a search for:
sizingInfo = sizingInfo + " Single trading method is enabled. ";

Replace the entire block of code with:

Code: Select all

   if (UseSingleTradingMethod)
   {
      sizingInfo = sizingInfo + "   Single trading method is enabled. ";
      if (TypeOfOrder == MarketOrder)
         sizingInfo = sizingInfo + "Sending immediate market orders.";
      else
         sizingInfo = sizingInfo + "Sending stop orders at " + IntegerToString(StopOrderDistancePips) + " pips from market price.";  
   }//if (UseSingleTradingMethod)
   else   
      sizingInfo = sizingInfo + "   Grid trading method is enabled";
: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
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Moving Day

Post by SteveHopwood »

I have created four new demo accounts that you can follow. Details in post 2.

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

Moving Day

Post by SteveHopwood »

I got 1b's upload wrong earlier - or forgot to upload it. Try again, folks.

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

Moving Day

Post by SteveHopwood »

MD took a bath last week. Newcomers will be wondering what the fuss is about. :lol: The least bad was a stop order at 20 pips. 10 pips was murdered.

I received this in an email from youcrazykids:
I’ve been watching Moving Day and its variants of late, and had some tentative thoughts on how to improve performance. Because one-third of trades are winners and two-thirds are losers, it follows that the winners should be milked for all they’re worth, and the losers should be curtailed as far as possible: 1) Scaling out could help to reduce the losses caused by losing trades, 2) When trades do head in the right direction, stacking trades in a grid (or a rolling grid) could really turbocharge the profits of these winning trades.
All this is in 1d - post 1 as usual. Scaling out is in the trade exits inputs and works as in Desky and SPCB.

There is a new input for grid trading: PendingDistanceToFirstTradePips. This is for when the first trade is a stop order and tells MD how far away from market to set the fill price. Assuming the initial trade has a take profit set, the the additional stop orders will have the same tp. All trades in the position will close at the same time.

I am going to set this up on the three demos I list in post 2. PendingDistanceToFirstTradePips will be set to 10, 15, 20 respectively. I have added a set file to post 1 to help you set up quickly and easily - "MD scale out and grid.set". This starts the grid 20 pips away from the market price, then sends four more grid trades 20 pips apart. The take profit is 100 pips and the dire emergency stop loss is 300 pips.

You can experiment with a far distant take profit, grid size, rolling grid etc. It is all in the user guide but you do not need this if you are already familiar with these functions.

Don't try to DIY unless you are very confident. Adding code like this causes me to examine existing code and I could not see how the hidden stop loss and take profit code could work properly so I made a lot of changes there, including adding Global Variables to store the hidden stops. I also spotted a couple of horrendous bloops in the sell grid order sending; I had an immediate market order set to send a buy trade instead of a sell - one of my infamous copy/paste/forgot-to-edit bloops.

There could be bugs, so sing out if you notice anything strange.

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

Moving Day

Post by SteveHopwood »

That youcrazykids' inspired idea of sending a grid of pending orders makes a huge difference became apparent today. :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

1e is in post 1. MD should have sent 5 pending orders: the initial trigger order then the grid of 4. He appears to have only sent 3 in total. I am not sure if the fix in 1e will sort this out entirely. We shall see.

To apply your own fix, go to the end of:
void lookForTradingOpportunities(string symbol, int pairIndex)

Scroll up about 12 lines to the code block that sends the buy and sell grids. Replace the entire block with this:

Code: Select all

            //Send the grid
            if (type == OP_BUYSTOP)
               sendBuyGrid(symbol, OP_BUYSTOP, price + (distanceBetweenTrades / factor), sendLots, TradeComment);
            else
               sendSellGrid(symbol, OP_SELLSTOP, price - (distanceBetweenTrades / factor), sendLots, TradeComment);
Explanation: 'price' is either the market price if the trigger trade is an immediate market trade, or pendingDistanceToFirstTrade pips away from the market if the trigger trade is a stop order. 'price' needs adjusting when sent to the buy/sell grid functions or the first trade in the grid is not sent to avoid price duplication. Whether the fix will result in all 5 orders being sent remains to be seen.

The scale out stop loss code is working to an extent, but not as I intend. I shall look into that.

I remind you folks that Thomas has uploaded new versions of TDesk and assorted stuff. Current versions will expire tomorrow.

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

Moving Day

Post by SteveHopwood »

MD is sending 4 orders now - still short by 1. I have attempted a fix and will post it when I have redone the scaling out thingy.

For now, those of you who can, do a search for:
if(doesTradeExist(symbol,type,price))

Insert this just above the 'continue;' command:
cc--;

Repeat the search and insertion as this code needs to go into two functions.

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

Moving Day

Post by SteveHopwood »

Just to let you know folks, that I have spent much of today battling with scale out stop loss code for Moving Day. It occurred to me that it would be possible to accommodate account based lot sizing using Global Variables to store the lot size of the trigger trade. The details are proving to be a bit of a bugger. :arrrg:

More as soon as I have frightened the problems into running away.

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

Moving Day

Post by SteveHopwood »

Everyone likes a laugh at my expense.

bobier sent me a fix a few minutes ago, for a chart display thingy when the broker has a pair prefix/suffix. I was not aware of the problem as my broker is Global Prime and they do not fart around with such nonsense. Here is my reply:
Nice one Alex. Thanks. :clap: :clap: :clap: :clap: :clap:

Have a laugh at my expense. It occurred to me that Global Variables could be used to store the trigger trade's lot size so that scaling out could be applied to variable lot sizes such as lots per dollop etc.

Nothing I tried would work. The sodding GV's refused to appear. I cursed. I swore. I vowed never to touch CrapQl4 ever again. I have less hair now than I had this morning. The cats left home through terror. The birds I feed daily sat at the bottom of the garden trembling.

After several hours of frustration, I realised I had not added the code that would produce the GV's because I had not added the code that would send the trigger trade as a stop order. This also explained why the grid was always one trade short.

:arrrg: :arrrg: :arrrg: :arrrg: :arrrg: :arrrg: :arrrg: :arrrg: :arrrg: :arrrg:

Hey ho. Updated code attached. I shall add scale back in and release it in time for market opening after the weekend.

Cheers

Scaling back in is coming. In the meantime, the attached should work properly it terms of scaling out. Don't bother trying to DIY; life is too short.

Scaling out is now independent of the stop loss. NoOfLevels tells MD how many times to apply scaling out. DistanceBetweenLevelsPips is how many pips are between scale out levels. PercentToClose is the percentage of the order to close - 25% by default.

:xm: :rocket:

EDIT: The scaling out is still not quite correct. The bot is closing the correct percentage but at 4 pip intervals not 20. Anyone here able to spot why will spare the cats more pain tomorrow:
bool scaleOutStopLoss(int ticket)
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. [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
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Moving Day

Post by SteveHopwood »

1f is in post 1. The glitch with the scaling out was an incorrect divisor in one of the equations.

I have added scaling back in as well. There is a quick and easy set file to turn everything on.

Everything appears to be working as intended.

: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.
trader689
Trader
Posts: 644
Joined: Thu Nov 17, 2011 12:53 am

Moving Day

Post by trader689 »

great thanks Steve! :clap:

trader
Post Reply

Return to “Moving Day”