KiteXL lag_processor clock speed

Let me first congratulate the team for the latest version of KiteXL. Everything is working great :)

My query is related to the processor clock speed. I have built a trading strategy using resistance levels.... when the price is greater than the resistance price a sell order will be executed and vice versa. In order to avoid the order getting executed multiple times, I have used the following VBA code:
Private Sub Worksheet_Calculate()
Dim A As Range, r As Range
Set A = Range("F8:F200")
Set B = Range("G8:G200")
Set C = Range("J8:J200")
Set D = Range("C8:C200")

For Each m In D
If m.HasFormula And m.Value > 0 Then
m.Value = m.Value
Call GetPositions
End If
Next m

For Each x In A
If x.HasFormula And x.Value > 0 Then
x.Value = x.Value
Call GetPositions
End If
Next x

For Each y In B
If y.HasFormula And y.Value > 0 Then
y.Value = y.Value

End If
Next y

For Each Z In C
If Z.HasFormula And Z.Value > 0 Then
Z.Value = Z.Value

End If
Next Z

End Sub

Also I am calling the function getpositions in order to fetch the price.

I have observed excel hanging and few orders not getting executed.

I have 30-50 stocks in the watchlist. My laptop has AMD A8 processor with a clock speed of 1.9 GHZ and 5 years old. Running Excel 2013.

So my question: Is it the processor or there is a better VBA code
  • HowUTrade


    Few points regarding Excel:
    *Excel is mostly single threaded.
    *Excel will calculate a formula only when the referenced value/cell value changes.

    You should not use Worksheet_Calculate to restrict order or for any other thing.
    You must use only when no other alternates is available.

    You should use dictionaries to store the order placed details and check the same before placing another order. Please go through the below articles.
    1. Order Restriction using Dictionaries
    2. Custom Tag

    You should not pull GetOrderBook/GetTradeBook/GetPositions for real time analysis.
    Instead use GetOrder* functions to get order details.
  • Dinesh1234
    Thanks.... works like a gem. I had one more query. Is there a way to get total number of positions in excel i.e. total number of executed orders at any instant

  • HowUTrade

    KiteNet RTD server supports real time Position details.
    Refer this for more details.

    If you want to know all the orders placed,
    You can call GetOrderIds , this will return csv of OrderId's placed in a symbol and product.

Sign In or Register to comment.