<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — Powershell Automation --input not working]]></title>
		<link>https://forexsb.com/forum/topic/9896/powershell-automation-input-not-working/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/9896/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Powershell Automation --input not working.]]></description>
		<lastBuildDate>Thu, 16 Jan 2025 22:04:06 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Powershell Automation --input not working]]></title>
			<link>https://forexsb.com/forum/post/82394/#p82394</link>
			<description><![CDATA[<div class="quotebox"><cite>Popov wrote:</cite><blockquote><p>Try to print the `$inputFileName` and check if the file actually exists.</p><p>The quotes seem to me unbalanced here:<br /></p><div class="codebox"><pre><code> &quot;--input&quot;, &quot;`&quot;$inputFileName`&quot;&quot;,</code></pre></div></blockquote></div><p>Thanks for the quick response.</p><p>I did question the strange imbalanced looking quotes, but apprently it is correct and has to do with handling of the variables/strings and so on within PS. And the --output was working with the same imbalanced looking quotes anyway.</p><p>But, your suggestion for checking file existence got me to the answer: Because I&#039;m using absolute paths when calling generate.js, I need to also specify the file extension .json on the end. Not needed on the output side as I guess your js handles this. For completness I have added it on the output side anyway.</p><p>Thanks</p>]]></description>
			<author><![CDATA[null@example.com (begoodall)]]></author>
			<pubDate>Thu, 16 Jan 2025 22:04:06 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/82394/#p82394</guid>
		</item>
		<item>
			<title><![CDATA[Re: Powershell Automation --input not working]]></title>
			<link>https://forexsb.com/forum/post/82393/#p82393</link>
			<description><![CDATA[<p>Try to print the `$inputFileName` and check if the file actually exists.</p><p>The quotes seem to me unbalanced here:<br /></p><div class="codebox"><pre><code> &quot;--input&quot;, &quot;`&quot;$inputFileName`&quot;&quot;,</code></pre></div><br /><p>Edit: The backticks are correct!</p>]]></description>
			<author><![CDATA[null@example.com (Popov)]]></author>
			<pubDate>Thu, 16 Jan 2025 20:39:30 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/82393/#p82393</guid>
		</item>
		<item>
			<title><![CDATA[Powershell Automation --input not working]]></title>
			<link>https://forexsb.com/forum/post/82390/#p82390</link>
			<description><![CDATA[<p>Hi All</p><p>I&#039;ve recently got into EG and I&#039;m trying to automate as much as possible. I started with DOS cmd, but I am now moving all my programs onto Powershell, so I can then move to Linux, so I can then get a Cloud VPS to run things 24/7. The Powershell on Linux part is to avoid expensive Windows cloud licences, but still remain compatible with my local machine.</p><p>Attached is a validate and generate powershell script. It runs, but it can&#039;t find any existing collection to load - and I know they exist. It ouputs the collection at the end of the run perfectly well. It can&#039;t then read it back in.</p><p>Any ideas? Maybe I&#039;ve gone bug-blind and can&#039;t see something obvious in my code :-/</p><p>Many thanks.</p><p>[I can&#039;t seem to attach the ps1 file, but hopefully the code is readable / will run if someone were to put it in a ps1 file]</p><div class="codebox"><pre><code># Define the parameters for each run
$runs = @(
    @{ Symbol = &quot;AUDJPY&quot;; Period = &quot;M15&quot;; DataStart = &quot;2014-01-01&quot;; DataEnd = &quot;2023-04-01&quot;; RunTimeMinutes = &quot;1&quot; },
    @{ Symbol = &quot;AUDJPY&quot;; Period = &quot;M15&quot;; DataStart = &quot;2014-10-01&quot;; DataEnd = &quot;2023-10-01&quot;; RunTimeMinutes = &quot;1&quot; }
)

# Run each process in parallel
$runs | ForEach-Object -Parallel {
    # Define the function for Node.js process execution
    function Run-NodeProcess {
        param (
            [string]$Symbol,
            [string]$Period,
            [string]$DataStart,
            [string]$DataEnd,
            [string]$RunTimeMinutes,
            [string]$BaseDirectory = &quot;D:/EG&quot;,
            [string]$SettingsFilePath = &quot;$BaseDirectory/genmaster.ini&quot;,
            [string]$ScriptFilePath = &quot;$BaseDirectory/bin/gen.js&quot;
        )

        # Generate input and output filenames using string interpolation
        $inputFileName = &quot;$BaseDirectory/collections/$Period/Coll-IS-$Symbol-$Period-$DataStart&quot;
        $outputFileName = &quot;$BaseDirectory/collections/$Period/Coll-IS-$Symbol-$Period-$DataStart&quot;

        # Ensure the output directory exists
        $outputDir = Split-Path -Path $outputFileName -Parent
        if (-not (Test-Path -Path $outputDir)) {
            New-Item -ItemType Directory -Path $outputDir -Force | Out-Null
        }

        # Debugging: Log paths
        Write-Output &quot;Input File:  $inputFileName&quot;
        Write-Output &quot;Output File: $outputFileName&quot;

        # Start the Node.js process with the provided variables
        Start-Process -FilePath &quot;node&quot; -ArgumentList @(
            &quot;`&quot;$ScriptFilePath`&quot;&quot;,
            &quot;--settings&quot;, &quot;`&quot;$SettingsFilePath`&quot;&quot;,
            &quot;--symbol&quot;, $Symbol,
            &quot;--period&quot;, $Period,
            &quot;--use_data_start&quot;, &quot;true&quot;,
            &quot;--data_start&quot;, $DataStart,
            &quot;--use_data_end&quot;, &quot;true&quot;,
            &quot;--data_end&quot;, $DataEnd,
            &quot;--max_working_minutes&quot;, $RunTimeMinutes,
            &quot;--validate_then_generate&quot;, &quot;true&quot;,
            &quot;--opposite_entry_signal&quot;, &quot;IgnoreOrReverse&quot;,
            &quot;--stop_loss_usage&quot;, &quot;AlwaysUse&quot;,
            &quot;--stop_loss_type&quot;, &quot;Fixed&quot;,
            &quot;--stop_loss_range_min&quot;, &quot;20&quot;,
            &quot;--stop_loss_range_max&quot;, &quot;200&quot;,
            &quot;--take_profit_usage&quot;, &quot;AlwaysUse&quot;,
            &quot;--take_profit_range_min&quot;, &quot;20&quot;,
            &quot;--take_profit_range_max&quot;, &quot;200&quot;,
            &quot;--take_profit_gte_stop_loss&quot;, &quot;true&quot;,
            &quot;--min_count_of_trades&quot;, &quot;100&quot;,
            &quot;--min_profit&quot;, &quot;10&quot;,
            &quot;--min_profit_factor&quot;, &quot;1.2&quot;,
            &quot;--enable_monte_carlo&quot;, &quot;false&quot;,
            &quot;--input&quot;, &quot;`&quot;$inputFileName`&quot;&quot;,
            &quot;--output&quot;, &quot;`&quot;$outputFileName`&quot;&quot;
        ) -WindowStyle Normal -Wait
    }

    # Call the function
    Run-NodeProcess -Symbol $_.Symbol -Period $_.Period -DataStart $_.DataStart -DataEnd $_.DataEnd -RunTimeMinutes $_.RunTimeMinutes
} -ThrottleLimit 4</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (begoodall)]]></author>
			<pubDate>Thu, 16 Jan 2025 17:42:42 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/82390/#p82390</guid>
		</item>
	</channel>
</rss>
