Updating training October 2024
This commit is contained in:
@@ -166,7 +166,8 @@ namespace MarketData.CNNProcessing
|
||||
for(int noiseIndex=0;noiseIndex<NoiseArray.Length;noiseIndex++)
|
||||
{
|
||||
double noise=NoiseArray[noiseIndex];
|
||||
String strPathFileName=String.Format("{0}{1}_{2}_{3}_{4}_{5}_{6}_{7}.jpg",strFolderPath,testCase.Symbol,index,penIndex,noiseIndex,testCase.TypeCase.ToString(),testCase.TypeGenerate.ToString(),Utility.DateToLong(testCase.PurchaseDate));
|
||||
// String strPathFileName=String.Format("{0}{1}_{2}_{3}_{4}_{5}_{6}_{7}.jpg",strFolderPath,testCase.Symbol,index,penIndex,noiseIndex,testCase.TypeCase.ToString(),testCase.TypeGenerate.ToString(),Utility.DateToLong(testCase.PurchaseDate));
|
||||
String strPathFileName=CreateFileName(strFolderPath,testCase.Symbol,testCase.DayCount,index,penIndex,noiseIndex,testCase.TypeCase,testCase.TypeGenerate,testCase.PurchaseDate);
|
||||
testCase.PathFileNames.Add(strPathFileName);
|
||||
ProcessPriceData(testCase,penWidth,noise);
|
||||
}
|
||||
@@ -182,7 +183,8 @@ namespace MarketData.CNNProcessing
|
||||
for(int noiseIndex=0;noiseIndex<NoiseArray.Length;noiseIndex++)
|
||||
{
|
||||
double noise=NoiseArray[noiseIndex];
|
||||
String strPathFileName=String.Format("{0}{1}_{2}_{3}_{4}_{5}_{6}_{7}.jpg",strFolderPath,testCase.Symbol,index,penIndex,noiseIndex,testCase.TypeCase.ToString(),testCase.TypeGenerate.ToString(),Utility.DateToLong(testCase.PurchaseDate));
|
||||
// String strPathFileName=String.Format("{0}{1}_{2}_{3}_{4}_{5}_{6}_{7}.jpg",strFolderPath,testCase.Symbol,index,penIndex,noiseIndex,testCase.TypeCase.ToString(),testCase.TypeGenerate.ToString(),Utility.DateToLong(testCase.PurchaseDate));
|
||||
String strPathFileName=CreateFileName(strFolderPath,testCase.Symbol,testCase.DayCount,index,penIndex,noiseIndex,testCase.TypeCase,testCase.TypeGenerate,testCase.PurchaseDate);
|
||||
testCase.PathFileNames.Add(strPathFileName);
|
||||
ProcessBollingerBandData(testCase,penWidth,noise);
|
||||
}
|
||||
@@ -200,7 +202,8 @@ namespace MarketData.CNNProcessing
|
||||
for(int noiseIndex=0;noiseIndex<NoiseArray.Length;noiseIndex++)
|
||||
{
|
||||
double noise=NoiseArray[noiseIndex];
|
||||
String strPathFileName=String.Format("{0}{1}_{2}_{3}_{4}_{5}_{6}_{7}.jpg",strFolderPath,testCase.Symbol,index,penIndex,noiseIndex,testCase.TypeCase.ToString(),testCase.TypeGenerate.ToString(),Utility.DateToLong(testCase.PurchaseDate));
|
||||
// String strPathFileName=String.Format("{0}{1}_{2}_{3}_{4}_{5}_{6}_{7}.jpg",strFolderPath,testCase.Symbol,index,penIndex,noiseIndex,testCase.TypeCase.ToString(),testCase.TypeGenerate.ToString(),Utility.DateToLong(testCase.PurchaseDate));
|
||||
String strPathFileName=CreateFileName(strFolderPath,testCase.Symbol,testCase.DayCount,index,penIndex,noiseIndex,testCase.TypeCase,testCase.TypeGenerate,testCase.PurchaseDate);
|
||||
testCase.PathFileNames.Add(strPathFileName);
|
||||
ProcessBollingerBandData(testCase,movingAverage,penWidth,noise);
|
||||
}
|
||||
@@ -210,6 +213,11 @@ namespace MarketData.CNNProcessing
|
||||
}
|
||||
}
|
||||
|
||||
private String CreateFileName(String strFolderPath,String symbol,int dayCount,int index,int penIndex,int noiseIndex,TestCase.CaseType caseType,TestCase.GenerateType generateType,DateTime purchaseDate)
|
||||
{
|
||||
return String.Format("{0}{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}d.jpg",strFolderPath,symbol,index,penIndex,noiseIndex,caseType.ToString(),generateType.ToString(),Utility.DateToLong(purchaseDate),dayCount);
|
||||
}
|
||||
|
||||
private void ProcessBollingerBandData(TestCase testCase,int movingAverageDays,float penWidth,double noise)
|
||||
{
|
||||
int bufferDays=60;
|
||||
@@ -238,9 +246,9 @@ namespace MarketData.CNNProcessing
|
||||
double movingAverageClose=dmaPricesByDate[bollingerBandElement.Date].AVGPrice;
|
||||
close[bollingerBands.Count-index-1]=(float)Math.Log(movingAverageClose)*1000.00f;
|
||||
}
|
||||
Numerics.ZeroForNaN(ref k);
|
||||
Numerics.ZeroForNaN(ref l);
|
||||
Numerics.ZeroForNaN(ref close);
|
||||
Numerics.ZeroForNaNOrInfinity(ref k);
|
||||
Numerics.ZeroForNaNOrInfinity(ref l);
|
||||
Numerics.ZeroForNaNOrInfinity(ref close);
|
||||
float maxY=Math.Max(Numerics.Max(ref l),Math.Max(Numerics.Max(ref close),Numerics.Max(ref k)));
|
||||
float minY=Math.Min(Numerics.Min(ref l),Math.Min(Numerics.Min(ref close),Numerics.Min(ref k)))-5f;
|
||||
float maxX=close.Length;
|
||||
@@ -324,9 +332,9 @@ namespace MarketData.CNNProcessing
|
||||
l[bollingerBands.Count-index-1]=(float)Math.Log(bollingerBandElement.L)*1000.00f;
|
||||
close[bollingerBands.Count-index-1]=(float)Math.Log(bollingerBandElement.Close)*1000.00f;
|
||||
}
|
||||
Numerics.ZeroForNaN(ref k);
|
||||
Numerics.ZeroForNaN(ref l);
|
||||
Numerics.ZeroForNaN(ref close);
|
||||
Numerics.ZeroForNaNOrInfinity(ref k);
|
||||
Numerics.ZeroForNaNOrInfinity(ref l);
|
||||
Numerics.ZeroForNaNOrInfinity(ref close);
|
||||
float maxY=Math.Max(Numerics.Max(ref l),Math.Max(Numerics.Max(ref close),Numerics.Max(ref k)));
|
||||
float minY=Math.Min(Numerics.Min(ref l),Math.Min(Numerics.Min(ref close),Numerics.Min(ref k)))-5f;
|
||||
float maxX=close.Length;
|
||||
@@ -373,14 +381,12 @@ namespace MarketData.CNNProcessing
|
||||
|
||||
if(testCase.TypeOutput.Equals(TestCase.OutputType.OutputFile))
|
||||
{
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Writing {0}",testCase.ToString()));
|
||||
if(File.Exists(testCase.LastPathFileName))File.Delete(testCase.LastPathFileName);
|
||||
if(UseGrayScale)imageHelper.SaveGrayScaleJPG(testCase.LastPathFileName);
|
||||
else imageHelper.SaveBlackAndWhiteJPG(testCase.LastPathFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Streaming {0}",testCase.ToString()));
|
||||
testCase.Streams.Add(imageHelper.SaveBlackAndWhiteJPG());
|
||||
}
|
||||
}
|
||||
@@ -397,7 +403,7 @@ namespace MarketData.CNNProcessing
|
||||
{
|
||||
priceArray[index]=(float)Math.Log((double)priceArray[index])*1000.00f;
|
||||
}
|
||||
Numerics.ZeroForNaN(ref priceArray);
|
||||
Numerics.ZeroForNaNOrInfinity(ref priceArray);
|
||||
|
||||
float maxY=Numerics.Max(ref priceArray);
|
||||
float minY=Numerics.Min(ref priceArray)-5f;
|
||||
@@ -424,14 +430,12 @@ namespace MarketData.CNNProcessing
|
||||
|
||||
if(testCase.TypeOutput.Equals(TestCase.OutputType.OutputFile))
|
||||
{
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Writing {0}",testCase.ToString()));
|
||||
if(File.Exists(testCase.LastPathFileName))File.Delete(testCase.LastPathFileName);
|
||||
if(UseGrayScale)imageHelper.SaveGrayScaleJPG(testCase.LastPathFileName);
|
||||
else imageHelper.SaveBlackAndWhiteJPG(testCase.LastPathFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Streaming {0}",testCase.ToString()));
|
||||
testCase.Streams.Add(imageHelper.SaveBlackAndWhiteJPG());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user