Assistance with finding average tick spread

General discussion about the Tickstory Lite software package.
Post Reply
greavette
Posts: 1
Joined: Fri Nov 03, 2023 6:05 pm

Assistance with finding average tick spread

Post by greavette »

Hello Team,

I'm very new to Tickstory and I'm looking to learn how I can identify the average tick spread on various forex paris. I've installed tickstory free and I'm currently downloading pairs I'll be researching. Could someone point me to documentation or provide steps for me on how I can see the average tick spread on these forex pairs I'm downloading?

Thank you in advance for any help you can provide me.

Thank you.

tickstory
Posts: 4900
Joined: Sun Jan 06, 2013 12:27 am

Re: Assistance with finding average tick spread

Post by tickstory »

Hi Greavette,

Please refer the "Custom token Reference" section in our manual for exporting custom formatted data to file (and also our YouTube demo on this topic). You can use the token {BarMaxSpreadInt} if you want to output a bar's spread in the exported data or {BarMinSpreadInt} if you want to use tick data. You can then run a Powershell similar to that below to calculate the average spread (this is untested and you will need to make your own modifications to suit):

Code: Select all

# Set the path to your CSV file and the column name for spread
$csvFilePath = "path\to\your\exported_data.csv"
$spreadColumnName = "Spread"

# Initialize variables for total spread and count of data points
$totalSpread = 0
$count = 0

# Check if the CSV file exists
if (Test-Path -Path $csvFilePath -PathType Leaf) {
    # Import the CSV data
    $csvData = Import-Csv -Path $csvFilePath

    # Loop through the data and calculate the total spread
    foreach ($row in $csvData) {
        $spread = [decimal]$row.$spreadColumnName
        $totalSpread += $spread
        $count++
    }

    if ($count -gt 0) {
        $averageSpread = $totalSpread / $count
        Write-Host "Average Spread: $($averageSpread.ToString("N2")) pips"
    } else {
        Write-Host "No data found in the CSV file."
    }
} else {
    Write-Host "CSV file not found."
}
Hope that helps.

Post Reply