Consulting

Page 4 of 4 FirstFirst ... 2 3 4
Results 61 to 75 of 75

Thread: Bet Angel and Excel

  1. #61
    Hi Sam:

    IYO would it be faster to use the current system with two workbooks?
    I used an addin in the application that I wrote, but I have no comparison with using two instantiations of EXCEL. At a guess I wouldn't think it would make much difference. I would hope that EXCEL would work out the multi threading as best it could either way.

    I think the way you have designed it; keeping everything in memory, gives this a good chance of working either way .

    I am still not sure whether a "free for all" with all the objects competing for processor time is the optimal way of organising this, or whether some sort of scheduler is going to be necessary. Is there going to be some way fo preventing one UDO getting priority over the the others. We don't need to recalculate everything all the time. It this going to be part of the EXCEL Helper??

  2. #62
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    5,975
    Location
    This will be part of the Helper Book

    Only new data will "raise" a Calculation. Since all Calculations occur in Child UDOs, the Main "Brand" Class can regulate when new data is added to a Child Object. This can easily be done with each Objects Ready Property. If needed.

    "Ready" merely idicates that an Object is done computing it's outputs.

    For Example the MACD Object uses three child Calculator Objects. When each Child is "Ready," the MACD is "Ready."

    What do you think? Should those Caculator Objects have a single input value that can be either an array or a single value, or should they have two (SeriesIn* is W/O) Properties, an Array and a singleton? I'm thinking that a "Initialized" R/O Property can tell the Main Parent Object(s) which to use.
    If UDO.Initialized THen 
        UDO = Singleton 'Value is Default UDO Property
    Else 
        UDO.SeriesIn = Series 
    End If 
    
    
    Formatting tags added by mark007
    Inside the Calculator
    Property Let SeriesIn(*) 
        pValue = CalculateSeries(SeriesIn) 
    End Property 
    Property Let Value(*) 
        pValue = CalculateSingleton(Value) 
    End Property 
    Property Get Value() 
        Value = pValue 
    End Property 
    
    
    Formatting tags added by mark007

    I am thinking that an If... Then... Else... that assumes Initialized is a very fast method of decision making
    Please take the time to read the Forum FAQ

  3. #63
    22711981_10155830266507767_1164743788_o.jpg
    Hi lads. I look forward to helping develop the BA help app once it’s up and running, I should be able to assist in some small way from the start and even more as I grow in confidence and ability. I know all about never ending lists, I am a Year 4 teacher in a local primary school and there just aren’t enough hours in the day! I hope you get your water running soon and good luck with the knee!

    I am currently running excel on a 13-inch mid 2010 MacBook Pro with a 2.4GHz Intel Core 2 Duo processor and 2GB 1067 MHz DDR3 memory (I have bigger memory modules ready to transfer in). I am running Windows on a partitioned hard drive (with about 80GB of free space). With regard to excel, I am currently running Microsoft Excel 2016 MSO 32-bit. Is anything after 2007 i.e. 2016 fine for multithreading? For quicker speeds, safety and efficiency I was thinking of eventually, or rather really soon, upgrading to a private VPS/VPN. Would this work or are there implications that arise with these? BA offer a standard one by the looks of things but only with average speeds of 30ms, I’m sure there are better online…
    https://www.betangel.com/vps/

    Apologies if I have missed anything, here are my replies to Sam’s notes:
    No need to keep the results, I have been working on a way of recording P/L via BetAngel after the races have ended.

    If Range("P45:P103").Value = "PLACED" Then Range("PLACED").ClearContents
    Very important!

    Yes, whenever I say 3 seconds I mean a look period of 15 iterations.

    Money flow index (Uses the difference of money flow (volume at best three back and best three lay prices in it’s calculation so it’s a more detailed formula to show volatility than WOM I assumed, its purpose is to show false signals and again be a ‘confirmation’ trigger but if WOM does this adequately IYO then that’s fine.

    By front four runners I mean the ones that are trading the most prior to the 10 minute out period when my system will start. These will be locked in position (Rows H, J, L, N) to avoid confusion.

    Regarding back/lay (see the attached picture):

    Please excuse the crude sketch of a random oscillating wave. This example follows a RSI. The first signal is when the RSI line (Check it’s only one line) crosses above the 30 mark so I will ‘Buy’ or ‘Back’ when it crosses the 50 line, I will ‘Sell’ or ‘Lay’. Then Lay when it crosses from above the 70 line, Back when it crosses the 50 line. On top of this, if a signal reverts back to it’s original position i.e. in the first example, the crosses above the 30 mark but it could then have dropped back below 30 instead of crossing the 50, in this instance I would ‘Close Trade’. I believe this is the simplest system that I can then tweak, add to and develop further in the future for all indicators. The only difference between this and a conventional RSI is I don’t just buy at over/under sold levels but exit trades when they reach stability again – this level can and will be tweaked with. Now once these ‘triggers’ activate they need to be ‘remembered’ within a look back period of 15 so if all three triggers activate within 15 intervals of one another, a ‘Back’, ‘Lay’, or ‘Close Trade’ will commence.

    To open a trade at all, all three must trigger. To close a trade, whether that be ‘Back’, ‘Lay’ or ‘Close trade’, only two out of the three indicators will need to cross the trigger threshold within a 15 period of each other. Hopefully this simple trigger system will help in your decision regarding your last post. I understand the first part of having separate child calculation objects running independently but not whether it should have a single input value or have two, sorry; hopefully something offthelip knows the answer to.

    The MFI (If used) will work the same way. The MACD will simply be when the lines cross above the signal (as default) then a “Back” will trigger, if the line crosses below the signal line then “Lay”.

    Just to clarify before I do this wrong, what do you mean by you want me to arrange BA data columns? You want me to make a new template sheet like the one BetAngel have supplied with the green and white stripes but with information most relevant to my system? How will we direct information to go into the correct cells. Do I need to use/manipulate the current set up or am I missing the point altogether?

    Cheers,

    CPerry.

  4. #64
    Hi Cperry:
    I am running Windows on a partitioned hard drive (with about 80GB of free space). With regard to excel, I am currently running Microsoft Excel 2016 MSO 32-bit.
    Does this mean that you are running Microsoft office (EXCEL) under windows as a virtual Machine on your Macbook Pro, or are you running the Mac version of Microsoft Office?

    2.4GHz Intel Core 2 Duo processor and 2GB 1067 MHz DDR3 memory
    Is a fairly slow machine by modern standards. Also I notice you are using the 32 bit version of EXCEL. the 64bit version is much faster (in theory).

    The good news about this is that you have got plenty of scope to improve perfomance by upgrading to a faster machine. I agree with Sam's suggestion get yourself a gaming desktop machine, with a cheap video card.
    Just as an aside I always use a gaming keyboard with my desktop because the response is so much better and faster. ( I never play games on the computer!!)

  5. #65
    Hi Sam:
    What do you think? Should those Caculator Objects have a single input value that can be either an array or a single value, or should they have two (SeriesIn* is W/O) Properties, an Array and a singleton? I'm thinking that a "Initialized" R/O Property can tell the Main Parent Object(s) which to use.
    I think that when initialising a calculator using it is useful to be able to pass an array, ( see the initialisation in my RSI function) however when running I think we should always pass a single variable, since this is all that is necessary and it will minimise the calculations. The only exception to this is if Cperry adds any indicators that are not based on EMA type calculations, currently all the indicators are based on EMA calculations.
    Also I think the calculator object should store the whole series from when it starts ( it is all in RAM anyway so won't take any time or significant space.) this can be useful when trying to debug the system. i.e when looking at it, we think it should have triggered and we find it doesn't or vice versa. By having a record of every calculation will allow us to go over it in detail to find where the code has gone wrong. So I think the calculator object should have three gets for values , get single value ( the latest), get 15 values ( last 3 seconds) , get the whole lot, however many it is.

  6. #66
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    5,975
    Location
    Is anything after 2007 i.e. 2016 fine for multithreading?
    They will all Multi-thread, but I haven't found a way to put the Helper Excel into it's own process after 2010. IMO, the fastest will be keeping each instance of Excel as separate as possible.

    Keep in mind that Excel is a native Microsoft Application. MACs must jump thru loops to run it, thus slowing it down. I think that a Windows 7 machine with Excel 7 will provide more ROE than a VPN. On Ebay, today, I saw Office 7 suites for $25us and up and many Windows 7 CD's for less than $50us. On Craig's List, here in Missouri, there are many high end Gaming Computers from $500us to $2500us.

    Just to clarify before I do this wrong, what do you mean by you want me to arrange BA data columns?
    The less interactivity BA has with the Excel Worksheet, the faster the entire system will be. Interacting with a Worksheet always takes a relatively large amount of time and CPU cycles.

    The more BA Data you can remove from the BA sheet, the better. All I, as a coder, want to see on that worksheet, is the Data my Code needs to work with. Do the best Bet Angel will let you get away with. Keeping in mind that you will want to refine your system in the future, however, just keep it to Races for the nonce.
    e
    The "Custom Settings" sheet, on the third hand, should be developed with a cell for every possible current and future setting. This is where you define what possible values to use in the Projects calculations. For example, You might use WOM or Monet Flow; Define all settings that either may use, Remember that I defined different Smoothing and Series Length inputs for all three WOM series thus allowing for future use right at the beginning. I will try to get a sample "Custom Settings" Sheet for you to start with.

    How will we direct information to go into the correct cells.
    Via the "Custom Settings" worksheet.

    WOM does this adequately IYO then that’s fine.
    That is a decision you must make. I just design the App so it will be "easy" for you to experiment.
    Please take the time to read the Forum FAQ

  7. #67
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    5,975
    Location
    I think that when initialising a calculator using it is useful to be able to pass an array, ( see the initialisation in my RSI function) however when running I think we should always pass a single variable, since this is all that is necessary and it will minimise the calculations.
    Oh, yeah!

    Also I think the calculator object should store the whole series from when it starts
    I'm thinking to keep all that in the Data Accumulator Object, with a possible Upper limit set on the Custom Settings Sheet. This also allows for simple Whole Race Logging if the User wants. It still allows for testing of all calculations that need any length series.

    I see the Data Flow as:

    1. The BA Worksheet_Change Pushes the entire BA Data Table to the BA.Output Object
    2. The Helper.Accumulator, Pulls the latest BA Data Table from the Output Object
      1. The Acumulator parses the Data and appends it into a FIFO Object, by Brand Name.

    3. Each Helper.Brand Object Pulls it's data, by name and series length, from the Accumulator.
    4. Each Brand object parses this data by Fields and Pushes it to the Calculator Objects.
      1. The Calculators only store the last input and the output



    #3 Acculumator Method:
    Public Function Value(BrandName As String, Optional SeriesLength As Long = 1) As Variant 
         'Code TBD
    End Function 
    
    
    Formatting tags added by mark007
    I will see if one can set a Let .Value Sub as the Default Property and if that sets the .Value Method as the default Output Property. It would be nice
    Accumulator = BA.OutPut 
    Me.SeriesInput = DataAccumulator(Me.Name, SeriesLength) 
    
    
    Formatting tags added by mark007
    I am starting to think that the DataAccumulator Object will be doing as much work as the rest of the Helper book put together. See 2.a above.

    NOTE TO SELF: Each Objects inputs set pReady = False. Each Object has IsReady Procedure to check all Child Objects Ready Property. If all Child's are True, sets Parent's pReady to True.
    Please take the time to read the Forum FAQ

  8. #68
    I'm thinking to keep all that in the Data Accumulator Object, with a possible Upper limit set on the Custom Settings Sheet. This also allows for simple Whole Race Logging if the User wants. It still allows for testing of all calculations that need any length series.
    I like the idea of this, it keeps all of the series in one place, it will make it easier to spot timing issues between different parts of the system.

    Each Brand object parses this data by Fields and Pushes it to the Calculator Objects.The Calculators only store the last input and the output

    So I presume that the Brand object is going to push the new indicator values back to the Data accumulator object.

    Is the Brand object also going to be the one that tests last 15 samples of the three indicators to see is a trigger has occured, or will you do that in another object. I would favour a separate object for doing this partly to make the Brands object simpler ( but not simple!!) and also to make changing it easier.

    I am not sure where the split between a 20ms update rate and a 200ms update rate is occuring in your model, is it the Helper.Accumulator that is going to do this, so the FIFO per brand name is updated every 200 ms (10 frames) of is the Brand object going to do this, so it only call the calculator units once every 10 updates?

  9. #69
    Hi Cperry,
    You need to expand on your set of rules for the RSI trigger: because I can see a number of conditions that you have not catered for, eg:
    1: What happens if the RSI drops below 50, so you open a sell, and then it goes up to 70 without going below 30 ( this is very likely to happen). do you open a second sell.
    2: If the rSI goes above 50 so you open a buy and then drop below 50, do you sell immediately? If the indicator is oscillating around 50 you could burn up a lot of money being "whipsawed"
    3: If the RSI drops below 30 and the comes above 30 but the drop through 30 again do you open 2nd buy position ?

    I am not sure I have catered for all conditions here, but you must think about the full set of rules you need, computers are really dumb, they only do what you tell them,

  10. #70
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    5,975
    Location
    So I presume that the Brand object is going to push the new indicator values back to the Data accumulator object.
    I hadn't considered that. I would probably Push the results to a different Object, just for debugging logging. Turn it off for speed during Production runs. Just another Custom Setting.

    I am not worried about Startup and Initialization times. I consider that to be a Capital Expense. I want to minimise Operating Expenses, CPU load and Time. The only OE I want is the Calculator Objects, and, data Passage and Parsing. Everything else should be a Capital Expense.

    Is the Brand object also going to be the one that tests last 15 samples of the three indicators to see is a trigger has occurred,
    Do that in another object.

    where the split between a 20ms update rate and a 200ms update rate is occuring in your model,
    I'm ignoring CPU Timing. The Brand Object is all based on when an object is ready. Since the Main Brand Object is "Ready=True" as soon as all its Children are ready, It will trigger another round of Calculating and data Transfer as often as programmatically possible. I think that as soon as the Brand Object Pushes its Decisions to the Excel Helper Application's CellPrinter UDO, the Brand starts over with the latest BA output.

    In Fact, the Excel Helper Application's CellPrinter UDO might be the one to log that data stream. It will be in a different Process.

    NOTES TO SELF: All Parent or Container, Objects need Ready=True Event
    pReady = Child1.Ready And Child2.Ready And...

    Do While Not pReady 'Any good ideas for this?
        DoEvents 
    Loop 
     
     'Ouput all data, Main Brand Object only
    Application.CellPrinterObj = Me.Data 'Array
    pReady = False 
     
     'Or, Output Data, then
    Do While pReady 'OutputValue Property Gets cumulatively reset pReady to False when read
        DoEvents 
    Loop 
     
    Me.Start Over 
    
    
    Formatting tags added by mark007



    Local and Global Reset Methods
    Method ResetGlobal() Passes ReSetGlobal to all Childs
    Method Reset("Child") Passes ResetGlobal To Named Object
    Need good ChildCollection Object
    Need pPArent Object in each Child







    @ All
    Given good Child Collections and pParent Objects, can a grandChild and a grandParent use each others Properties?

    As simple as GloballyUniquePropertyName = X?
    Or something like Me.Parent.Parent.Property = X?



    Can a Cell in one instantiation of Excel refer to anything in an different Instantiation of Excel?
    How?



    Thanks. Off to DuckDuckGo now
    Please take the time to read the Forum FAQ

  11. #71
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    5,975
    Location
    From my Previous:
    Can a Cell in one instantiation of Excel refer to anything in an different Instantiation of Excel?
    How?
    DuckDuckGo Says, https://support.microsoft.com/en-us/help/555159
    Please take the time to read the Forum FAQ

  12. #72
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    5,975
    Location
    From my Pre-Previous
    From grandParent to grandChild
    Duckduckgo says:
    https://stackoverflow.com/questions/...l-class-module
    http://vbi.org/Items/article.asp?id=78
    http://www.vbaexpress.com/forum/show...Keyword-in-VBA



    @ CPerry, you might want to look at this since we are doing a lot of talking about, and your Project is being built with, Class Modules.
    https://excelmacromastery.com/vba-class-modules/
    Please take the time to read the Forum FAQ

  13. #73
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    5,975
    Location
    This might be a good computer for you, 549 € and up, depending on selected internals
    https://slimbook.es/en/power-minipc-one

    They're in Spain, if that means anything,
    I'll bet they do customs.
    Please take the time to read the Forum FAQ

  14. #74
    I'm ignoring CPU Timing. The Brand Object is all based on when an object is ready. Since the Main Brand Object is "Ready=True" as soon as all its Children are ready, It will trigger another round of Calculating and data Transfer as often as programmatically possible
    I am worried about this, it is what I have been worried about right from the start. It is unneccessary to calculate everything as fast as possible and it will limit the thoughput if you do. I am not talking about CPU timings I am talking about update rates and iterations rates.

    The data update from BA comes in every 20 to 50 ms.
    Cperry has clearly stated that he would like to see an update every 200ms, which seems a reasonable update rate.
    To do the OHLC calculation the BRAND needs to check every update, but it doesn't need to recalculate the indicators or save the OHLC and start a new one.
    It only needs to do this once every 200ms. Also we do not need to upate all the Brand simulataneously.

    If you recalculate every Brand calculation as fast as you can, you are wasting processor time because you could well be doing the recalculations more frequently than once every 200ms. There is no requirement to calcualte the indicators that fast.
    This means that once you have two or three "brands" running you might run out of power. While if you recalculate each Brand only once every 200ms you can calculate far more of them.

    As an example assume it takes 10 ms to update one brand. If we recalculate two brands we will just about get this done in between data updates and everything is then running flat out.

    What happens if we now add a third brand? How is the processor time shared between the three brands? We know that we will get a data update before they are finished, what happens if one the Brands always finishes in less time that the others does that mean it gets calculated more frequently? What happens if the brand does a recalculation before the data had been updated.

    An EMA time series only works correctly if we have fixed (or at least known) time intervals between each data update. How are we supposed to calculate the Time constants for EMA if we don't know how often the series is being calculated.


    There is another issuse with this in that the requirement for a trigger is to look at the last 3 seconds worth of data and indicators. If you are writing data out as fast as you can, how are you going to tell how long the the array is going to be for 3 seconds worth?

    I still favour a deterministic approach where we control what is calculated and when as I outlined in my post #50.
    This will give us update for the calculated arrays every 200ms. The only issue being how we determine when the 200ms is due.

  15. #75
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    5,975
    Location
    It is unneccessary to calculate everything as fast as possible and it will limit the thoughput if you do.
    First A Question: Which is easier? Slow down an APP or Speed it up?

    As I see it, you are saying that is is faster to do a sequential calculation that takes a few thousand CPU tiks every 500 million CPU tiks than do perform the same sequential calculations on demand every several thousand CPU Ticks.

    This App is designed to be optimized for speed by both the VBA Compiler and the Windows Operating system. It has plenty of all needed delays built in, in fact I'm putting in too much delay, but all delays are fine tunable. That is something CPerry can do AFTER I have a FrameWork for him. The first such Delay is that the BA Application only outputs one table of Updated Data every ten updates. The Main Helper Controller Object cannot even Read the parsed Data until the Helper's DataParser gets done splitting all the BA data into Brand size Bites and turned its own (Read) Ready Property to True. Another built-in Delay is that the Main Controller Object must wait for every Brand Object to be Ready = True before it can Write new Data to it. Below that, The Brand Object is not Ready = True until A: it has completed all computations and B: it has passed all its outputs and is idle .

    You do brring up a thought about ThroughPut Timing snafuus, For Maximum speed of Throughput, I see a need for a Boolean Dictionary, keyed by Brand.Name and whose values are Brand.Readys, The Main Controller BrandUpdater UDO will use
    For Each Brnd In Brands Collection 
        If BrandReadyDict (Brnd.Name).Ready 
        Then Data Dump Brnd 
    
    
    Formatting tags added by mark007
    Maybe later if it's an issue

    An EMA time series only works correctly if we have fixed (or at least known) time intervals between each data update.
    There is no fixed time interval available, That is provided by an out Object over the internet.

    How are we supposed to calculate the Time constants for EMA if we don't know how often the series is being calculated.
    By using BA Update tiks, or as close to a constant fraction thereof as we can manage. Everybody involed undertands that an Update tic is as close a timing mark as is available. We cannot Force BA to follow any timing system we use. Our Timing must be based on the BA. The Curves the outputs are based on will be a little fuzzy, but close enough and a whole lot faster than using a TI Scientific calculator. The Prices in a Race just don't move that fast.

    If you are writing data out as fast as you can, how are you going to tell how long the the array is going to be for 3 seconds worth?
    When the BAUpdateTikCounter reaches about 150? 1500? Hmmmn. I think that Wild Turkey is getting between me and my brain.

    Please keep your comments coming, they're really helping me see things more clearly.

    Just what are we talking about besides Data Flow? Each Brand is only tracking three to six curves. There is a stated limit of About 30 Brands. 180 Calculations on a fast MultiCore with Multithreading? Plus the Boolean Decision Tree. Writing the data to Cells is NOT a Brand UDO function.

    @ CPerry, Think of a Class Module's (a UDO's) Property pVariable as the name of a particular address in RAM. The beauty of VBA's Classes is that a Child and a Parent can share the same piece of Memory with different Address Names. There is no Throughput overhead in that case. WAIT! I think that Turkey interpreted what I tried to say.

    Good night
    Sam
    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •