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

Desky. TDesk's trading drone.
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5545
Page 5 of 50
Author:  SteveHopwood [ Tue Oct 23, 2018 10:47 am ]
Post subject:  Desky. TDesk's trading drone.

Vokin » Tue Oct 23, 2018 8:49 am wrote:Hi,
i have this problem:
Setting
-- All trades belong to a single basket --
TreatAllPairsAsBasket = true
BasketTargetCash = 50
Now the cash is higher than the set, but the basket is not closed.
Problem as always with my old eyes?
Thanks for answer.
I should have realised the feature wasn't working when I closed the position manually on Friday - blame The Flatulent Beauty And Her Sodding Beast.

None of the global basket stuff is working in 1k because I forgot to add the code that holds the totals - fixed in 1l.

Easy fix for the DIYers. Do a search for "CashUpl = 0;//For keeping track of the cash cash Upl of multi-trade/hedged positions" and insert this underneath:

Code: Select all

   //Global basket trading
   TotalPipsUpl = 0;//Global pips total
   TotalCashUpl = 0;//Global cash total
Then do a search for "if (!BetterOrderSelect(cc, SELECT_BY_POS, MODE_TRADES) ) continue;" This will be around line 978/9ish.
Insert this code block underneath:

Code: Select all

      //Global basket trading
      if (TreatAllPairsAsBasket)
      {
         TotalCashUpl+= OrderProfit() + OrderSwap() + OrderCommission();
         pips = CalculateTradeProfitInPips(OrderType());
         TotalPipsUpl+= pips;
      }//if (TreatAllPairsAsBasket)
It MUST GO above "//Ensure the EA 'owns' this trade"

:xm: :rocket:
Author:  SteveHopwood [ Tue Oct 23, 2018 10:53 am ]
Post subject:  Desky. TDesk's trading drone.

I just thought of an extra conditional that can be added to the second block of code:

Code: Select all

      //Global basket trading
      if (TreatAllPairsAsBasket)
      {
         TotalCashUpl+= OrderProfit() + OrderSwap() + OrderCommission();
         if (OrderType() < 2)
         {
            pips = CalculateTradeProfitInPips(OrderType());
            TotalPipsUpl+= pips;
         }//if (OrderType() < 2)
      }//if (TreatAllPairsAsBasket)
All the extra conditional does is force the routine to include only market orders. This does not matter much as stop and limit orders will have zero upl values.

:xm: :rocket:
Author:  Vokin [ Tue Oct 23, 2018 12:37 pm ]
Post subject:  Desky. TDesk's trading drone.

You are quick.
Now I.
Fixing code, compiled, cleared variables, run EA, without success.
Dload your 1l, compiled, cleared variables, run EA, without success.
:arrrg: :arrrg:
Author:  SteveHopwood [ Tue Oct 23, 2018 12:52 pm ]
Post subject:  Desky. TDesk's trading drone.

Vokin » Tue Oct 23, 2018 12:37 pm wrote:You are quick.
Now I.
Fixing code, compiled, cleared variables, run EA, without success.
Dload your 1l, compiled, cleared variables, run EA, without success.
:arrrg: :arrrg:
You have no profit targets displayed on your screen, so you do not have any set. That one is down to you.

:xm: :rocket:
Author:  Vokin [ Tue Oct 23, 2018 2:18 pm ]
Post subject:  Desky. TDesk's trading drone.

Now i really dont now what is wrong.
TreatAllPairsAsBasket = true
BasketTargetCash = 100
What I need to set up for Basket TP?
Author:  SteveHopwood [ Tue Oct 23, 2018 2:41 pm ]
Post subject:  Desky. TDesk's trading drone.

Vokin » Tue Oct 23, 2018 2:18 pm wrote:Now i really dont now what is wrong.
TreatAllPairsAsBasket = true
BasketTargetCash = 100
What I need to set up for Basket TP?
It is not you Vokin. I had Desky using a dynamic cash TP so my screen was showing a target. It stopped doing so as soon as I canceled the dynamic TP and used BasketTargetCash.

BasketTargetCash is getting reset to 0 somewhere. I will post when I find it. For now, set a dynamic TP.

:xm: :rocket:
Author:  SteveHopwood [ Tue Oct 23, 2018 3:08 pm ]
Post subject:  Desky. TDesk's trading drone.

Found it. There are a couple of variables concerning the Friday reducing basket TP figure that I had declared but not populated. Fixed in 1m in post 1.

Easieast DIY yet, I reckon. Do a search for, "return(INIT_SUCCEEDED);" and insert this code just above - about line 610ish:

Code: Select all

   OriginalBasketTargetCash=BasketTargetCash;
   OriginalBasketTargetPips=BasketTargetPips;   
:xm: :rocket:
Author:  Vokin [ Wed Oct 24, 2018 7:45 am ]
Post subject:  Desky. TDesk's trading drone.

Sorry Steve.
TP is now visible, but the basket is still not closed.
Its not big problem for me, i can use your MPTM.
Regards V.
Author:  Vokin [ Wed Oct 24, 2018 12:18 pm ]
Post subject:  Desky. TDesk's trading drone.

Its cool thisMT4.
Now i dont see nothing here, but EA close and open repeatedly USD/JPY. :o
Author:  Dragonian [ Wed Oct 24, 2018 1:30 pm ]
Post subject:  Desky. TDesk's trading drone.

Vokin » 24 Oct 2018 13:18 wrote:Its cool thisMT4.
Now i dont see nothing here, but EA close and open repeatedly USD/JPY. :o
I found that if I entered a basket take profit lower than that which had already been achieved then the graphic would disappear, as in your image. Put in a take profit amount higher than currently shown and it should re-appear.

My basket's still don't close when target hit though.
All times are UTC Page 5 of 50