Author Topic: DDEInitiate Hanging Excel and MFPro  (Read 4138 times)

Tags:
  • All members
  • Posts: 10
DDEInitiate Hanging Excel and MFPro
« on: 03 Nov 2016, 13:01 »
Hi there,

Apologise if I've posted this in the wrong section but I'm currently developing a spreadsheet that links into MFPro using TimeMachine and need it to be able to place bets through an Excel sheet as this mimics my live trading environment.

After reading through the manual the following code is recommended for Excel to communicate with MFPro:

Sub Back(marketID As Long, selectionID As Long, price As Double, amount
As Double, handicapID as Long)
Dim feed As Integer
Dim data As String
feed = Application.DDEInitiate("FEEDER7", "betting")
If feed > 0 Then
data = "back/" & marketID & "/" & selectionID & "/" & price & "/" &
amount & "/" & handicapID
Range("AB1000") = data
Application.DDEPoke feed, "bet", Range("AB1000")
End If
End Sub

However when testing the "feed = Application.DDEInitiate("FEEDER7", "betting")"  causes both excel and MFPro to hang and I have to restart both applications and cannot get any further. I've checked on the help forum and cannot see any conclusive posts on how to fix this issue other than another user has had the same thing happen.

Can anyone advise on how I can fix this as I desperately need to get this working in order to fully implement my test trading environment. Alternatively is there another way of sending basic Back, Lay, Cancel and GreenUp commands to MFP through a button click in excel (possibly having MFP monitoring a hidden cells in excel and executing a command based on this)?

Any suggestions more than welcome

Many thanks

Matt

  • Moderator
  • Posts: 3597
*
Re: DDEInitiate Hanging Excel and MFPro
« Reply #1 on: 03 Nov 2016, 18:18 »
Hi
The latest version is MarketFeeder 8. The executable is feeder8.exe.
In the line you highlighted try replacing FEEDER7 with FEEDER8

You can easily bet using trigger conditions according to excel data, example:

action: back
price: back_price
condition: selections back price is less than cell_Sheet1_A1

here the trigger condition picks up the value of Sheet1!A1.

Could also use to monitor your hidden cells? e.g. 0/1:
condition: selections trigger expression cell_Sheet2_F5 is equal to 1

Did you see the sections in the help file on Excel-Bound variables and Custom Cells? Unless the VBA is something you really want to do, I think everything can be done through the Excel variables.




Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 10
Re: DDEInitiate Hanging Excel and MFPro
« Reply #2 on: 03 Nov 2016, 19:55 »
Thanks for your reply Mark

Yes that was one of the first things I tried but unfortunately it still causes the issue. I'm quite familiar with VBA programming hence it would have been the perfect solution if it had worked.

Triggers were the next thing I've been looking at. If I were to go down this route would I need to create individual triggers for each Back and Lay option?

So for example using the correct score market I would have to create 19 Back triggers/19 Lay triggers (one for each score line) each monitoring their own hidden cell in Excel.

If you look at the attached screen shot (Back_Trigger_001.png) I've attempted to create a trigger that:

1. Places a back bet at the current back price using the monetary amount in Cell B4 of Sheet1 in Excel (See Spreadsheet_Trigger_001.png)
2. The condition should place the bet when the value of Cell C4 (Hidden place bet Cell) changes to  a 1
3. Once the bet has been matched reset the Cell C4 (Hidden place bet Cell) back to 0 so that further 0-0 back bets can be be placed if needed throughout the match.

What I can't see is how I would then connect this trigger to say just the 0-0 scoreline (as the value in Cell B4 is unique to this)?
I also want the trigger to run any time the Cells value changes from a 0 to 1 and wondered what settings I should use for "Repeat" and "Execute". 

Would be great to get your thoughts on this?

Thanks

Matt

  • Administrator
  • Posts: 8821
  • Gender: Female
*
Re: DDEInitiate Hanging Excel and MFPro
« Reply #3 on: 03 Nov 2016, 20:12 »
Hello!

There seems to be an outdated piece of code in the manual (apologies for that, will fix it in the next update). Obviously, the program's version is now 8, so it should be:

feed = Application.DDEInitiate("FEEDER8", "betting")

Does it still hang if you change this piece of code?
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 10
Re: DDEInitiate Hanging Excel and MFPro
« Reply #4 on: 03 Nov 2016, 20:17 »
Hi Oxa,

Yes unfortunately it does. I set a break point in the code after this line and it never hits, it just hangs Excel and MFPro.

I'm using Excel 2007 if that makes any difference any other things I could try?

Thanks

  • Moderator
  • Posts: 3597
*
Re: DDEInitiate Hanging Excel and MFPro
« Reply #5 on: 03 Nov 2016, 20:53 »
What I can't see is how I would then connect this trigger to say just the 0-0 scoreline (as the value in Cell B4 is unique to this)?
Hi
quick reply on this:

for  0 - 0
selections index is equal to 1
and selections trigger expression cell_Sheet1_C4 is equal to 1

for  0 - 3
selections index is equal to 4
and selections trigger expression cell_Sheet1_C7 is equal to 1

for  1 - 3
selections index is equal to 8
and selections trigger expression cell_Sheet1_C11 is equal to 1

For the stake you could use a nested IF statement, e.g.:
IF(cell_Sheet1_C4=1, cell_sheet1_B4, IF(......))etc
or if you are using separate triggers for each scoreline, just use the cell reference.

If I get the chance I hope to answer your question on "repeating" tomorrow, but please have a read of this article which should give you a good start:
http://marketfeederpro.com/learn/articles/how-to-repeat-actions-in-the-same-market/
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 10
Re: DDEInitiate Hanging Excel and MFPro
« Reply #6 on: 04 Nov 2016, 09:26 »
Thank you for your help, that's really useful.

Just to let you know that the DDEInitiate is a problem at my end  :-[ Out of interest I tried installing and running MFPro on a different machine this morning and the DDEInitiate worked flawlessly so I'm trying to work out why at the moment.

I just wondered if it possible to pull the cash out (green up) figures into Excel I notice that they are available when running the interface in Engineering mode?

Thanks again

Matt

  • Administrator
  • Posts: 8821
  • Gender: Female
*
Re: DDEInitiate Hanging Excel and MFPro
« Reply #7 on: 04 Nov 2016, 11:48 »
I just wondered if it possible to pull the cash out (green up) figures into Excel

Yes, look up the tradeout_net selection variable and send it to Excel as a custom cell.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • Moderator
  • Posts: 3597
*
Re: DDEInitiate Hanging Excel and MFPro
« Reply #8 on: 04 Nov 2016, 14:35 »
Hi
Just to finish the brief explanation for repeating your triggers, if you read that article you will know about trigger blocks and using the close block trigger action.

your triggers in a <named> trigger block which repeats say every 5 secs
 
trigger 1. Places a back bet at the current back price using the monetary amount in Cell B4 of Sheet1 in Excel (See Spreadsheet_Trigger_001.png)
               condition should place the bet when the value of Cell C4 (Hidden place bet Cell) changes to  a 1. Execute: once per market
trigger 2. Once the bet has been matched reset the Cell C4 (Hidden place bet Cell) back to 0. Execute: once per market
trigger 3. close block <named>
               conditions: trigger 1 and trigger 2 have fired correctly, no unmatched bets left, etc... Execute: once per market

effectively you run each trigger once and repeat the block if all ok.

Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 10
Re: DDEInitiate Hanging Excel and MFPro
« Reply #9 on: 07 Nov 2016, 13:14 »
Thanks for your help.

Things are moving forward well now.. Just had a quick query about pulling the Green up figures into the spreadsheet using the custom cells as Oxa recommended using the tradeout_net and tradeout_pl variables.

However I cannot seem to get them to render any figures to the spreadsheet they just print out the variable text to the screen (see attached screen grab).

I've tried using them in different combinations and what I'm trying to achieve in this instance is to output the trade out figure for the correct score market i.e football2_tradeout_net

Can you see anything obvious that I'm doing wrong?

Thank you

Matt


  • Moderator
  • Posts: 3597
*
Re: DDEInitiate Hanging Excel and MFPro
« Reply #10 on: 07 Nov 2016, 14:18 »
Hi
tradeout_net is a selection variable, you need to define the selection. In the attached screenshot I have a bet on correct score 1 - 1 (selection index 6)
football2_s_6_tradeout_net

if you want the total tradeout_net for the market you need the sum of all the selections:
football2_s_1_tradeout_net+football2_s_2_tradeout_net+football2_s_3_tradeout_net......football2_s_19_tradeout_net
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 10
Re: DDEInitiate Hanging Excel and MFPro
« Reply #11 on: 07 Nov 2016, 14:50 »
Fantastic, thank you  ;D

  • All members
  • Posts: 10
Re: DDEInitiate Hanging Excel and MFPro
« Reply #12 on: 07 Nov 2016, 16:50 »
Hi Mark,

It still doesn't seem to be rendering the figure and still displays the text in the spreadsheet (see screen grab)

The variables definitely work as you can see that they are returning the correct values however when I transfer this into the Excel custom cells/formulae section it doesn't seem to parse and outputs the text string into the cell rather than the numeric value?

I've tried changing the cell formatting in Excel from gereral to account to currency to see if this may make a difference but still get the same result.

Do you know why this might be or any thing else I could try?

Best regards

Matt

  • Moderator
  • Posts: 3597
*
Re: DDEInitiate Hanging Excel and MFPro
« Reply #13 on: 07 Nov 2016, 17:47 »
Hi
The problem is that custom cell cannot distinguish which market the data is coming from, therefore it won't work, the helpfile section on custom cells explains better than I can.

I suggest as a workaround:
Custom Cell Address: S15:2
Value: tradeout_net

this will put each selections tradeout_net on the market sheet in column O
then use a custom cell to SUM that column in Excel and then transfer the value to your own sheet.

Alternatively, can you set up your own sheet data as custom cells on each market sheet?
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 10
Re: DDEInitiate Hanging Excel and MFPro
« Reply #14 on: 07 Nov 2016, 20:40 »
Thanks Mark,

That is exactly what I required.

All the best

Matt

 

Please note, BetFair is seems to be currently OFFLINE