<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — collection filename to include net profit]]></title>
		<link>https://forexsb.com/forum/topic/9430/collection-filename-to-include-net-profit/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/9430/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in collection filename to include net profit.]]></description>
		<lastBuildDate>Mon, 29 May 2023 04:48:20 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: collection filename to include net profit]]></title>
			<link>https://forexsb.com/forum/post/74968/#p74968</link>
			<description><![CDATA[<p>Thanks! Looks like the latest release includes this update : <a href="https://forexsb.com/forum/post/74929/#p74929">https://forexsb.com/forum/post/74929/#p74929</a>!</p>]]></description>
			<author><![CDATA[null@example.com (lisaforex)]]></author>
			<pubDate>Mon, 29 May 2023 04:48:20 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/74968/#p74968</guid>
		</item>
		<item>
			<title><![CDATA[Re: collection filename to include net profit]]></title>
			<link>https://forexsb.com/forum/post/74648/#p74648</link>
			<description><![CDATA[<p>woo! I&#039;ll wait for the official release instead of hacking away at the code. Thanks!</p>]]></description>
			<author><![CDATA[null@example.com (lisaforex)]]></author>
			<pubDate>Tue, 02 May 2023 06:53:05 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/74648/#p74648</guid>
		</item>
		<item>
			<title><![CDATA[Re: collection filename to include net profit]]></title>
			<link>https://forexsb.com/forum/post/74646/#p74646</link>
			<description><![CDATA[<p>Hello Lisa,</p><p>&gt; I would like to see a summary of all the profits in the collection in the filename.</p><p>This is a good idea. I&#039;ll implement it in the next Express Generator release (later this week).</p><p><strong>EDIT</strong></p><p>If you want to hack it yourself, you have to change two files:</p><p>1: C:\express-generator\bin\gen.js</p><p>Change line 285 with these two lines:<br /></p><div class="codebox"><pre><code>// Old
const collPath = makeCollectionPath(settings.output, dataEndText, dataId, collectionSize, settings.outputReplace)

// New
const profit   = collection.reduce((acc, rec) =&gt; acc + rec.stat.profit, 0)
const collPath = makeCollectionPath(settings.output, dataEndText, dataId, collectionSize, profit, settings.outputReplace)</code></pre></div><p>2: C:\express-generator\bin\lib\collection.js</p><p>Change the function signature on line 149 as follows:<br /></p><div class="codebox"><pre><code>// Old
function makeCollectionPath(path, timeUpdated, dataId, count, outputReplace)

// New
function makeCollectionPath(path, timeUpdated, dataId, count, profit, outputReplace)</code></pre></div><p>Append the [PROFIT] parameter as follows:<br /></p><div class="codebox"><pre><code>.replaceAll(&#039;[PROFIT]&#039;, profit.toFixed(0) )</code></pre></div><br /><p>If everything is alright, you can use it exactly as you requested it:</p><p>&gt; node bin/gen --symbol EURUSD --period M30 --output [SYMBOL]-[PERIOD]-[COUNT]-[PROFIT]</p><p>Produces:</p><p><a href="https://image-holder.forexsb.com/store/xgen-export-profit-in-coll-name.png"><span class="postimg"><img src="https://image-holder.forexsb.com/store/xgen-export-profit-in-coll-name-thumb.png" alt="https://image-holder.forexsb.com/store/xgen-export-profit-in-coll-name-thumb.png" /></span></a></p>]]></description>
			<author><![CDATA[null@example.com (Popov)]]></author>
			<pubDate>Tue, 02 May 2023 04:57:59 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/74646/#p74646</guid>
		</item>
		<item>
			<title><![CDATA[collection filename to include net profit]]></title>
			<link>https://forexsb.com/forum/post/74627/#p74627</link>
			<description><![CDATA[<p>Hi,</p><p>I am trying to achieve the following in Express Generator:</p><p>- generate strategies for 2 years (max 200 collection)<br />- run the top 200 strategies for the following month, and pick the top 10 (simulating DEMO testing)<br />- run the top 10 for the next month (simulating REAL trading)</p><p>I&#039;ve got everything I want working well. My final json file contains the 10 strategies with simulated &quot;real&quot; trading.</p><p>I can see the profits for each strategy in the json file uner &quot;profit&quot;.</p><p>I would like to see a summary of all the profits in the collection in the filename. </p><p>Example:<br /></p><div class="codebox"><pre><code>output = ./collections/Coll_[SERVER]_[SYMBOL]_[PERIOD]_[YEAR]-[MONTH]-[DAY]_str_[PROFIT].json</code></pre></div><p>I had a quick look though collection.js<br /></p><div class="codebox"><pre><code>    let collectionPath = path
        .replaceAll(&#039;[SERVER]&#039;, cleanName(dataId.source) )
        .replaceAll(&#039;[SYMBOL]&#039;, cleanName(dataId.symbol) )
        .replaceAll(&#039;[PERIOD]&#039;, periodToText(dataId.period) )
        .replaceAll(&#039;[YEAR]&#039;  , date.getUTCFullYear().toString() )
        .replaceAll(&#039;[MONTH]&#039; , (&#039;0&#039; + (date.getUTCMonth() + 1).toString()).slice(-2) )
        .replaceAll(&#039;[DAY]&#039;   , (&#039;0&#039; + date.getUTCDate().toString()).slice(-2) )
        .replaceAll(&#039;[HOUR]&#039;  , date.getUTCHours().toString() )
        .replaceAll(&#039;[MINUTE]&#039;, date.getUTCMinutes().toString() )
        .replaceAll(&#039;[COUNT]&#039; , count.toString() )
        .replaceAll(&#039;[PROFIT]&#039;, ???? )</code></pre></div><p> I&#039;m after something that will add profit to the filename, but my JS knowledge isn&#039;t that great.</p><p>I could code up something in python to extract the data from the json file, but I was hoping there would be an easier way if anyone knows?</p>]]></description>
			<author><![CDATA[null@example.com (lisaforex)]]></author>
			<pubDate>Sat, 29 Apr 2023 13:28:57 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/74627/#p74627</guid>
		</item>
	</channel>
</rss>
