Inside BidSize AskSize too large maybe  [SOLVED]

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Inside BidSize AskSize too large maybe

Postby bowlesj3 » 13 Nov 2020

Hi,

Because I am going to start trading larger I am gathering the (Max Min & Avg) BidSize and AskSize from these two Multicharts quote fields. They are being sent to GVs for display in an MS-Access database form/screen. Immediately I noticed the numbers seem far bigger than the sizes displaying on Interactive Broker's Traders Work Station. So I put a fileappend in to see if it matched up. My MC Code is below. It appears the values in the BidSize and AskSize fields are multiplied by 100. Am I reading this correctly? If so why would that be?

Thanks,
John

Code: Select all

//START: Code for getting the min,max,avg inside bid/ask sizes and sending them to MS-access to help with trading larger BidSizeTotal = BidSizeTotal + BidSize; BidSizeCnt = BidSizeCnt + 1; if BidSize < BidSizeMin then BidSizeMin = BidSize; if BidSize > BidSizeMax then BidSizeMax = BidSize; BidSizeAvg = BidSizeTotal / BidSizeCnt; value1 = A_GV_SetNamedInt("BidSizeMax",BidSizeMax); value1 = A_GV_SetNamedInt("BidSizeMin",BidSizeMin); value1 = A_GV_SetNamedInt("BidSizeAvg",BidSizeAvg); AskSizeTotal = AskSizeTotal + AskSize; AskSizeCnt = AskSizeCnt + 1; if AskSize < AskSizeMin then AskSizeMin = AskSize; if AskSize > AskSizeMax then AskSizeMax = AskSize; AskSizeAvg = AskSizeTotal / AskSizeCnt; value1 = A_GV_SetNamedInt("AskSizeMax",AskSizeMax); value1 = A_GV_SetNamedInt("AskSizeMin",AskSizeMin); value1 = A_GV_SetNamedInt("AskSizeAvg",AskSizeAvg); value1 = A_GV_SetNamedInt("DailyVolume",DailyVolume); FileAppend(LogPath,"Symbol=" + RealSym + " BidSize=" + numtostr(BidSize,0) + " AskSize=" + numtostr(AskSize,0) + " DailyVolume=" + numtostr(DailyVolume,0) + NewLine); //END: Code for getting the min,max,avg inside Bid/ask sizes and sending them to MS-access to help with trading larger

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Inside BidSize AskSize too large maybe  [SOLVED]

Postby bowlesj3 » 13 Nov 2020

My theory proved true. The values are correct when I divide them by 100. The corrected code is below. I can see the matching value about a second or two later in my MS-access display. Maybe it is because I am picking these fields up on 1 second bars rather than 1 minute bars (but I only thought that affected the time_s field).

Code: Select all

//START: Code for getting the min,max,avg inside bid/ask sizes and sending them to MS-access to help with trading larger. BidSizeDiv100 = BidSize / 100; BidSizeTotal = BidSizeTotal + BidSizeDiv100; BidSizeCnt = BidSizeCnt + 1; BidSizeAvg = BidSizeTotal / BidSizeCnt; if BidSizeDiv100 < BidSizeMin then BidSizeMin = BidSizeDiv100; if BidSizeDiv100 > BidSizeMax then BidSizeMax = BidSizeDiv100; value1 = A_GV_SetNamedInt("BidSize",BidSizeDiv100); value1 = A_GV_SetNamedInt("BidSizeMax",BidSizeMax); value1 = A_GV_SetNamedInt("BidSizeMin",BidSizeMin); value1 = A_GV_SetNamedInt("BidSizeAvg",BidSizeAvg); AskSizeDiv100 = AskSize / 100; AskSizeTotal = AskSizeTotal + AskSizeDiv100; AskSizeCnt = AskSizeCnt + 1; AskSizeAvg = AskSizeTotal / AskSizeCnt; if AskSizeDiv100 < AskSizeMin then AskSizeMin = AskSizeDiv100; if AskSizeDiv100 > AskSizeMax then AskSizeMax = AskSizeDiv100; value1 = A_GV_SetNamedInt("AskSize",AskSizeDiv100); value1 = A_GV_SetNamedInt("AskSizeMax",AskSizeMax); value1 = A_GV_SetNamedInt("AskSizeMin",AskSizeMin); value1 = A_GV_SetNamedInt("AskSizeAvg",AskSizeAvg); value1 = A_GV_SetNamedInt("DailyVolume",DailyVolume); //END: Code for getting the min,max,avg inside Bid/ask sizes and sending them to MS-access to help with trading larger

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Inside BidSize AskSize too large maybe

Postby syswizard » 13 Nov 2020

Very interesting. I'd love to know how you poked the GV's into MS Access. I'd like to do the same for Excel.
BTW: I see you were using SetNamedInt instead of SetNamedDouble.
It is my understanding that all system and user variables in MC are of double-precision floating point and that even declarations like:
Vars:
int myvar(0);
The above does not cast the doubles into integers.
Here is my trace of Bidsize and Asksize for the ES E-Mini contract....these look correct and do not require dividing by 100.

2020/11/03 21:02:35.470 @ES# TickCnt= 35 UpTicks= 132 DnTicks= 83 Ticks= 215 BidSize= 2 AskSize= 5 CumBid= 173 CumAsk= 242 Barstatus= 1 vBarStatus_prev= 1 T-Rate= 0.00
2020/11/03 21:02:36.528 @ES# TickCnt= 36 UpTicks= 132 DnTicks= 85 Ticks= 217 BidSize= 38 AskSize= 1 CumBid= 211 CumAsk= 243 Barstatus= 1 vBarStatus_prev= 1 T-Rate= 0.00
2020/11/03 21:02:36.528 @ES# TickCnt= 37 UpTicks= 132 DnTicks= 85 Ticks= 217 BidSize= 38 AskSize= 1 CumBid= 249 CumAsk= 244 Barstatus= 1 vBarStatus_prev= 1 T-Rate= 0.00
2020/11/03 21:02:36.840 @ES# TickCnt= 38 UpTicks= 132 DnTicks= 88 Ticks= 220 BidSize= 40 AskSize= 6 CumBid= 289 CumAsk= 250 Barstatus= 1 vBarStatus_prev= 1 T-Rate= 0.00
2020/11/03 21:02:36.840 @ES# TickCnt= 39 UpTicks= 132 DnTicks= 88 Ticks= 220 BidSize= 40 AskSize= 6 CumBid= 329 CumAsk= 256 Barstatus= 1 vBarStatus_prev= 1 T-Rate= 0.00
2020/11/03 21:02:37.515 @ES# TickCnt= 40 UpTicks= 137 DnTicks= 89 Ticks= 226 BidSize= 39 AskSize= 6 CumBid= 368 CumAsk= 262 Barstatus= 1 vBarStatus_prev= 1 T-Rate= 0.00
2020/11/03 21:02:37.515 @ES# TickCnt= 41 UpTicks= 137 DnTicks= 89 Ticks= 226 BidSize= 39 AskSize= 6 CumBid= 407 CumAsk= 268 Barstatus= 1 vBarStatus_prev= 1 T-Rate= 0.00
2020/11/03 21:02:38.243 @ES# TickCnt= 41 UpTicks= 152 DnTicks= 89 Ticks= 241 BidSize= 4 AskSize= 6 CumBid= 407 CumAsk= 268 Barstatus= 2 vBarStatus_prev= 1 T-Rate= 4.00

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Inside BidSize AskSize too large maybe

Postby bowlesj3 » 13 Nov 2020

These are the wrappers for access. The first set of code is complete for 64 bit only. The 2nd allows use in 64 bit or 32 bit. I have never used this in excel.

Code: Select all

Option Compare Database Option Explicit Private Declare PtrSafe Function GV_GetNamedBool Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intOther As Boolean, ByVal strElementLoc As String) As Boolean Private Declare PtrSafe Function GV_SetNamedBool Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As Boolean) As Long Private Declare PtrSafe Function GV_GetNamedDouble Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intOther As Double) As Double Private Declare PtrSafe Function GV_SetNamedDouble Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As Double) As Long Private Declare PtrSafe Function GV_GetNamedInt Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intOther As Single) As Long Private Declare PtrSafe Function GV_SetNamedInt Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As Long) As Long Private Declare PtrSafe Function GV_GetNamedFloat Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intOther As Single) As Single Private Declare PtrSafe Function GV_SetNamedFloat Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As Single) As Long Private Declare PtrSafe Function GV_GetNamedString Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal strOther As String) As String Private Declare PtrSafe Function GV_SetNamedString Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As String) As Long 'Numbered Boolean test This works in MS-Access and it picked up correctly in the system. Private Declare PtrSafe Function GV_GetBool Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long) As Boolean Private Declare PtrSafe Function GV_SetBool Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long, ByVal intSetValue As Boolean) As Long 'Numbered Double test This works in MS-Access and it picked up correctly in the system. Private Declare PtrSafe Function GV_GetDouble Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long) As Double Private Declare PtrSafe Function GV_SetDouble Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long, ByVal intSetValue As Double) As Long 'Numbered INTEGER test This works in MS-Access and it picked up correctly in the system. Private Declare PtrSafe Function GV_GetInteger Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long) As Long Private Declare PtrSafe Function GV_SetInteger Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long, ByVal intSetValue As Long) As Long 'Numbered Float single test Private Declare PtrSafe Function GV_GetFloat Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long) As Single Private Declare PtrSafe Function GV_SetFloat Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long, ByVal intSetValue As Single) As Long 'Numbered String Test Private Declare PtrSafe Function GV_GetString Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long) As String Private Declare PtrSafe Function GV_SetString Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal intElementLoc As Long, ByVal intSetValue As String) As Long Public Function A_GV_GetNamedBool(strName As String, blnErrorCode As Boolean) As Boolean A_GV_GetNamedBool = GV_GetNamedBool(blnErrorCode, strName) End Function Public Function A_GV_SetNamedBool(strName As String, dblGVvalue As Boolean) As Long A_GV_SetNamedBool = GV_SetNamedBool(strName, dblGVvalue) End Function '====================================================================================================================================================================== 'START: Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Public Function A_GV_GetNamedDouble(strName As String, lngErrorCode As Long) As Double A_GV_GetNamedDouble = GV_GetNamedDouble(strName, lngErrorCode) End Function Public Function A_GV_SetNamedDouble(strName As String, dblGVvalue As Double) As Long A_GV_SetNamedDouble = GV_SetNamedDouble(strName, dblGVvalue) End Function '====================================================================================================================================================================== 'START: Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Public Function A_GV_GetNamedInt(strName As String, lngErrorCode As Long) As Long A_GV_GetNamedInt = GV_GetNamedInt(strName, lngErrorCode) End Function Public Function A_GV_SetNamedInt(strName As String, lngGVvalue As Long) As Long A_GV_SetNamedInt = GV_SetNamedInt(strName, lngGVvalue) End Function '====================================================================================================================================================================== 'START: Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Public Function A_GV_GetNamedFloat(strName As String, lngErrorCode As Long) As Single A_GV_GetNamedFloat = GV_GetNamedFloat(strName, lngErrorCode) End Function Public Function A_GV_SetNamedFloat(strName As String, sngGVvalue As Single) As Long A_GV_SetNamedFloat = GV_SetNamedFloat(strName, sngGVvalue) End Function '====================================================================================================================================================================== 'START: Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Public Function A_GV_GetNamedString(strName As String, strErrorCode As String) As String A_GV_GetNamedString = GV_GetNamedString(strName, strErrorCode) End Function Public Function A_GV_SetNamedString(strName As String, strGVvalue As Variant) As Long A_GV_SetNamedString = GV_SetNamedString(strName, strGVvalue) End Function Public Function A_GV_GetBool(intElementLoc) As Boolean A_GV_GetBool = GV_GetBool(intElementLoc) End Function Public Function A_GV_SetBool(intElementLoc As Long, dblGVvalue As Boolean) As Long A_GV_SetBool = GV_SetBool(intElementLoc, dblGVvalue) End Function '====================================================================================================================================================================== 'START: Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Doubles Public Function A_GV_GetDouble(intElementLoc) As Double A_GV_GetDouble = GV_GetDouble(intElementLoc) End Function Public Function A_GV_SetDouble(intElementLoc As Long, dblGVvalue As Double) As Long A_GV_SetDouble = GV_SetDouble(intElementLoc, dblGVvalue) End Function '====================================================================================================================================================================== 'START: Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Integers Public Function A_GV_GetInt(intElementLoc) As Long A_GV_GetInt = GV_GetInteger(intElementLoc) End Function Public Function A_GV_SetInt(intElementLoc As Long, lngGVvalue As Long) As Long A_GV_SetInt = GV_SetInteger(intElementLoc, lngGVvalue) End Function '====================================================================================================================================================================== 'START: Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Floats Public Function A_GV_GetFloat(intElementLoc) As Single A_GV_GetFloat = GV_GetFloat(intElementLoc) End Function Public Function A_GV_SetFloat(intElementLoc As Long, sngGVvalue As Single) As Long A_GV_SetFloat = GV_SetFloat(intElementLoc, sngGVvalue) End Function '====================================================================================================================================================================== 'START: Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Strings Public Function A_GV_GetString(intElementLoc) As String A_GV_GetString = GV_GetString(intElementLoc) End Function Public Function A_GV_SetString(intElementLoc As Long, strGVvalue As Variant) As Long A_GV_SetString = GV_SetString(intElementLoc, strGVvalue) End Function

Code: Select all

Option Compare Database Option Explicit #If Win64 Then Private Declare PtrSafe Function GV_GetNamedFloat Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intOther As Single) As Single Private Declare PtrSafe Function GV_SetNamedFloat Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As Single) As Long Private Declare PtrSafe Function GV_GetNamedInt Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intOther As Single) As Long Private Declare PtrSafe Function GV_SetNamedInt Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As Long) As Long Private Declare PtrSafe Function GV_SetNamedString Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As String) As Long Private Declare PtrSafe Function GV_GetNamedString Lib "C:\Access\GlobalVariables\GlobalVariable.dll" _ (ByVal strElementLoc As String, ByVal strOther As String) As String #Else Private Declare Function GV_GetNamedFloat Lib "C:\Access\GlobalVariables\GlobalVariable_32bit.dll" _ (ByVal strElementLoc As String, ByVal intOther As Single) As Single Private Declare Function GV_SetNamedFloat Lib "C:\Access\GlobalVariables\GlobalVariable_32bit.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As Single) As Long Private Declare Function GV_GetNamedInt Lib "C:\Access\GlobalVariables\GlobalVariable_32bit.dll" _ (ByVal strElementLoc As String, ByVal intOther As Single) As Long Private Declare Function GV_SetNamedInt Lib "C:\Access\GlobalVariables\GlobalVariable_32bit.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As Long) As Long Private Declare Function GV_SetNamedString Lib "C:\Access\GlobalVariables\GlobalVariable_32bit.dll" _ (ByVal strElementLoc As String, ByVal intSetValue As String) As Long Private Declare Function GV_GetNamedString Lib "C:\Access\GlobalVariables\GlobalVariable_32bit.dll" _ (ByVal strElementLoc As String, ByVal strOther As String) As String #End If Public Function A_GV_GetNamedInt(strName As String, lngErrorCode As Long) As Long A_GV_GetNamedInt = GV_GetNamedInt(strName, lngErrorCode) End Function Public Function A_GV_SetNamedInt(strName As String, lngGVvalue As Long) As Long A_GV_SetNamedInt = GV_SetNamedInt(strName, lngGVvalue) End Function Public Function A_GV_GetNamedFloat(strName As String, lngErrorCode As Long) As Single A_GV_GetNamedFloat = GV_GetNamedFloat(strName, lngErrorCode) End Function Public Function A_GV_SetNamedFloat(strName As String, sngGVvalue As Single) As Long A_GV_SetNamedFloat = GV_SetNamedFloat(strName, sngGVvalue) End Function Public Function A_GV_GetNamedString(strName As String, strErrorCode As String) As String A_GV_GetNamedString = GV_GetNamedString(strName, strErrorCode) End Function Public Function A_GV_SetNamedString(strName As String, strGVvalue As Variant) As Long A_GV_SetNamedString = GV_SetNamedString(strName, strGVvalue) End Function

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Inside BidSize AskSize too large maybe

Postby syswizard » 14 Nov 2020

Wow, thanks a ton Bowles for those declarations.
Final questions:
1) How do you handle the synchronization between the sending app (MC) and receiving app (Access) ?
2) Why did you see the need to make "wrapper" functions for the DLL calls ?

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Inside BidSize AskSize too large maybe

Postby bowlesj3 » 14 Nov 2020

Wow, thanks a ton Bowles for those declarations.
Final questions:
1) How do you handle the synchronization between the sending app (MC) and receiving app (Access) ?
2) Why did you see the need to make "wrapper" functions for the DLL calls ?
Hi Syswizard, glad you like the stuff I posted.

Regarding synchronization, first off I do not use MC for auto-trading. I tried but I use a multi-level-wave trading system which also takes into account RSI level bounces and programming this for auto trading I have concluded to be impossible. The waves come in too many different shapes. The best I can do is get 80% accuracy (some are difficult to do manually and this is in effect the problem). So as a result MC and MS-Access work together to help me where I can get it to. So most times one of the two apps sends the GV data out and the other app picks it up as soon as it can. In MC the scripts all have the RecalcLastBarAfter(1) command at the very bottom of the script under the LastBarOnChart or LastBarOnChart_s if statement. So this forces a false tick every second such that the GVs in MC that send data to MS-Access will send it within 1 second. The transfer of the GV itself is essentially instant. Because I have 7 charts running in the MC workspace (1W 1D 30M 15M 5M 1M 1S) any delay beyond 1 second is caused by MC not getting through its chart scripts fast enough. Each chart has about 13 scripts and some are pretty big (that is a lot of code to process within 1 second). However with a quad core desktop it is pretty good. So there are a few situations where one of these two apps needs to know the other app got the GV data before it can proceed. In this case I usually use a count system and access is either using a 1 second timer on the form or I actually set a tight loop within access with a pause timer of 1 second. So the count switch will work like this; value=0 means Access has sent nothing. value=1 means access has initiated the process. When MC sees value=1 it does its thing and when completed it sets value=2. When Access sees value=2 it does its thing and sets value=0. This is a simple example. Before I switched from trading the E-mini future contract to trading stocks I had a switch that actually got up to value=8 with both access and MC doing multiple things back and forth.

Regarding the wrappers, I think I wanted all the code definitions in one spot. MC does that so I did the same in access.

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Inside BidSize AskSize too large maybe

Postby syswizard » 16 Nov 2020

Thanks Bowles. I see the RecalcLastBarAfter insures the sending of the data via GV Set call. However, does it mess-up the other code in the calling function or indicator ?

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Inside BidSize AskSize too large maybe

Postby bowlesj3 » 16 Nov 2020

Thanks Bowles. I see the RecalcLastBarAfter insures the sending of the data via GV Set call. However, does it mess-up the other code in the calling function or indicator ?
No, the way the scripts are executed is as follows.
#1 the bars are loaded for the chart but no scripts are executed yet.
#2 next the scripts are executed one by one (I think it works top to bottom in the list of scripts).
2a/ the scripts are initially executed top to bottom once for each historic bar in the chart working back to front
(70 bars 70 executions top to bottom).
2b/ The LastBarOnChart it statement prevents execution of that code until the last bar execution occurs.
2c/ when you go into format studies and choose the properties tab you find a checkbox called "update on every tick".
2d/ choosing "update on every tick" causes the whole script top to bottom to be executed on every tick. You have to prevent unwanted execution of code with if statements.

Once you have the "update on every tick" Here is where things get tricky. You need to realize variables get reset on every new tick unless you use IntraBarPersist. You need to read this post very carefully and maybe do the tests.
viewtopic.php?f=5&t=6871

Another thing that occurs during new ticks is line removal if the line is not drawn during barstatus=2. Read about BarStatus and read this thread right to the very bottom post I created about [RecoverDrawings = false]
viewtopic.php?f=1&t=6785

That should help a lot. Without this knowledge you will get confused as I did at the beginning. The reason is MC has these strange twists that make it different than normal programming languages. In the end when you understand it it turns out to be pretty smart.

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Inside BidSize AskSize too large maybe

Postby syswizard » 17 Nov 2020

Wow, Bowles...thanks for that extensive discourse on MC's execution process.
Here is the link to the new drawing directive: https://www.multicharts.com/trading-sof ... erDrawings

Re: BarStatus....you should be aware I have an outstanding support ticket regarding this. What I discovered is that Barstatus=0 (start of bar) is not being thrown consistently and that Barstatus=2 is thrown prematurely....at least on tick charts.
When I attempted to count the ticks for 200 tick chart in an indicator, my tick counts were from 50 to 100...despite the fact the internal tickcountdown counter appeared to be correct on the chart. I believe this problem has something to do with an internal "new tick" event handler in MC-14.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Inside BidSize AskSize too large maybe

Postby bowlesj3 » 17 Nov 2020

Re: BarStatus....you should be aware I have an outstanding support ticket regarding this. What I discovered is that Barstatus=0 (start of bar) is not being thrown consistently and that Barstatus=2 is thrown prematurely....at least on tick charts.
When I attempted to count the ticks for 200 tick chart in an indicator, my tick counts were from 50 to 100...despite the fact the internal tickcountdown counter appeared to be correct on the chart. I believe this problem has something to do with an internal "new tick" event handler in MC-14.
Not surprised. I don't use tick charts (do tick charts have a bar that collects multiple ticks? Could that be the issue you experience?). I use bars that are time based (1W 1D 30M 15M 5M 1M 1S). That's because I consider time very important. The only BarStatus value I test for is 2. It works flawlessly for me as far as I can tell. I do remember some sort of problem with one of the other values. I think it was first tick within the bar. This is probably why some of my old code tests time against previous time (cannot fail).

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Inside BidSize AskSize too large maybe

Postby syswizard » 17 Nov 2020

Not surprised. I don't use tick charts (do tick charts have a bar that collects multiple ticks? Could that be the issue you experience?).
Yes, of course...the end of bar should come at tick #200. That's not happening. IMHO that should not be happening with software this mature.
I use bars that are time based (1W 1D 30M 15M 5M 1M 1S). That's because I consider time very important.
Interestingly I've recently been close to some traders who swear by range bars and renko charts. They think I am weird in using tick bars.
So to summarize:
1) Time Bars = based on duration/time
2) Tick Bars = based on activity, # of trades
3) Range Bars = based on movement
4) Volume bars = based on volume...natch

Each have their merits and short-comings. One thing I've done recently is to compute the "rate of ticks" per second and I find it very valuable in determining when the market is likely to make a move.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Inside BidSize AskSize too large maybe

Postby bowlesj3 » 17 Nov 2020

Each have their merits and short-comings. One thing I've done recently is to compute the "rate of ticks" per second and I find it very valuable in determining when the market is likely to make a move.
I trade by waves (not Elliot waves but my own observations over a long period of time - like 22 years). Both waves in price and RSI which correspond and %R lately. I am fully aware of them in all bar sizes (1W 1D 30M 15M 5M 1M & 1S) - helps know when to scalp or hold. Waves are generally found by roughly (very roughly) equal distance between tops and bottoms (hence the need for time bars). I have a number of wave measurement tools that tell me when to get in and out (too complex to describe). Waves get distorted by various factors. This is where a lot of experience comes in and the reason programming this for full automation would be very difficult. I am 66 and started programming at 26 (40 years). I tried 3 or 4 times and decided it was a waste of time. However MC is very useful regardless especially when combined with MS-Access. I wanted to use some of the auto-trade commands but the Canadian Regulators blocked this (very annoying because I prefer to stay within my own currency).

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Inside BidSize AskSize too large maybe

Postby syswizard » 18 Nov 2020

Bowles,
Along the lines of this BidSize/AskSize topic, do you know if a Level I data feed for the CME E-Mini's provides for the BidPrice and AskPrice ?
I know of course that Power Language does not support those keywords.....but I've always wondered if they should ?
I'd like to know the volume of trades going off at the bid price vs. the ask price over a period of time.....or activity.

P.S. I'm right up there with you in age....there are old traders, bold traders, but no old, bold traders.....LOL.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Inside BidSize AskSize too large maybe

Postby bowlesj3 » 18 Nov 2020

do you know if a Level I data feed for the CME E-Mini's provides for the BidPrice and AskPrice ?
I never used them when I was trading the E-mini but my guess is they probably are available for the E-mini with all the brokers than can feed data to MC.

Code: Select all

I know of course that Power Language does not support those keywords.....but I've always wondered if they should ?
They do support keywords for this. They are called InsideBid and InsideAsk.
They are covered in the help manual. Check this directory\file that ends with .chm which is the windows help standard file.
C:\Program Files\TS Support\MultiCharts64\MultiCharts64.chm (make sure the extension is showing)
You can't get at this file from the multicharts (at least I can't figure out how). I use this file often (create a short cut to it).
You find those keywords under PowerLanguage, Keyword Reference, Quote fields by expanding the + signs. The Wiki came later.
I discovered them and started using them after I started trading stocks instead. See the code below.

Code: Select all

//START: code to keep the bid and ask price lines in place every second FutureDate = date; FutureTimeBA1 = A_TimeAddSub_s(Time_s, "A", 3, "S"); //Add ? seconds FutureTimeBA2 = A_TimeAddSub_s(Time_s, "A", 15, "S"); //Add ? seconds LinePriceForAsk = InsideAsk; value1 = A_GV_SetNamedFloat(RealSym + "_InsideAsk",LinePriceForAsk); //value1 = A_MoveTrendLine_s("AT",LineIDforAsk,FutureDate,FutureTimeBA1,LinePriceForAsk,FutureDate,FutureTimeBA2,LinePriceForAsk); value1 = TL_setbegin_s(LineIDforAsk,FutureDate,FutureTimeBA1,LinePriceForAsk); value1 = TL_setend_s(LineIDforAsk,FutureDate,FutureTimeBA2,LinePriceForAsk); LinePriceForBid = InsideBid; value1 = A_GV_SetNamedFloat(RealSym + "_InsideBid",LinePriceForBid); //value1 = A_MoveTrendLine_s("AT",LineIDforBid,FutureDate,FutureTimeBA1,LinePriceForBid,FutureDate,FutureTimeBA2,LinePriceForBid); value1 = TL_setbegin_s(LineIDforBid,FutureDate,FutureTimeBA1,LinePriceForBid); value1 = TL_setend_s(LineIDforBid,FutureDate,FutureTimeBA2,LinePriceForBid); //END: code to keep the bid and ask price lines in place every second
I'd like to know the volume of trades going off at the bid price vs. the ask price over a period of time.....or activity.
I don't use volume at all :-)
P.S. I'm right up there with you in age....there are old traders, bold traders, but no old, bold traders.....LOL.
Linda Bradford says good traders are cautious. If anyone knows she will :-)

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Inside BidSize AskSize too large maybe

Postby syswizard » 19 Nov 2020

Wow, thanks for that Bowles.....I had no idea there was a .chm help file. Hopefully, it is up-to-date with the Wiki docs unlike the PDF file that I use all of the time which dates back to 2016. I really love the PDF format because with Acrobat Pro it can be modified and with Acrobat Reader it can highlighted and commented. Of course, if I convert the CHM to PDF and then the documentation changes, I'm screwed.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: Inside BidSize AskSize too large maybe

Postby bowlesj3 » 19 Nov 2020

I had no idea there was a .chm help file. Hopefully, it is up-to-date.
I think they keep it up to date. The version 11 is significantly different than the version 10 which I copied. I would like to know how to get at it from within MC.

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Inside BidSize AskSize too large maybe

Postby syswizard » 19 Nov 2020

re: "I would like to know how to get at it from within MC."
It should have been put in the Help menu as a drop-down option....i.e. "Help File-CHM".
Better yet, two options: "Help File-CHM", "Help File-PDF".

I'll put in an enhancement request.


Return to “MultiCharts”