Example: Last trades reading

stable
By Stephan in Miscellaneous Published October 2020 👁 1,330 views 💬 0 comments

Description

This example shows how you can read the contents of the orderbooks in HaasScript. NOTE: Last trades is real-time data and can not be backtested, only paper-traded.
HaasScript
-- NOTE: Last trades is real-time data and can not be backtested, only paper-traded.

-- Running at high speed is highly recommended because last trades often change
EnableHighSpeedUpdates()

-- The last trades is provided to us as a simple array
lastTrades = GetLastTrades()

-- So we can just loop them or look in the values
Log('Trades')
for i=3, 1, -1 do
    Log(lastTrades[i][1]) -- And display the price
end
-- DoBuy DoSell

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!