а вот такой заработает? сигналы он показывает из старшего, но тестирование не выдает сделок почему-то
Код: Выделить всё
function Initialize()
{
IndicatorName = "A12";
AddInput("Input", Inputs.Candle);
PriceStudy = true;
AddSeries("H", DrawAs.Custom, Color.Magenta);
AddSeries("L", DrawAs.Custom, Color.Lime);
}
function Evaluate()
{
if (( Input.Close[0] < Input.Close[1]) && ( Input.Close[1] >= Input.Close[2]) )
{
H[-1] = Input.Close[1];
}
if (( Input.Close[0] > Input.Close[1]) && ( Input.Close[1] <= Input.Close[2]) )
{
L[-1] = Input.Close[1];
}
H.DrawArrowDown(Color.Red, LineStyles.Solid, 2, Color.Red, 5);
L.DrawArrowUp(Color.Lime, LineStyles.Solid, 2, Color.Lime, 5);
}
и WriteData для него
Код: Выделить всё
function Initialize()
{
IndicatorName = "WriteData_X";
PriceStudy = true;
AddInput("I", Inputs.Candle);
AddParameter("DataSlot", 0);
AddSeries("A");
}
function Evaluate()
{
var H = MY.A12(I).GetValue("H", 1);
var L = MY.A12(I).GetValue("L", 1);
if (DataSlot == 0) return;
string Path = @"DataSlot" + (int)DataSlot + "\\";
System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(Path);
if (!dirInfo.Exists) dirInfo.Create();
string Ticker = Input.VirtualSecurity.Split('=')[0];
string FileName = String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}",
Ticker, BarDate().Year, BarDate().Month, BarDate().Day, BarTime().Hours, BarTime().Minutes, BarTime().Seconds);
string URL = Path + FileName;
if (System.IO.File.Exists(URL) && CurrentIndex != MaxIndex) return;
ClearFile(URL);
WriteLine(URL, String.Format("{0};{1};{2};{3};{4};{5};{6};{7};{8};{9}", I.Open[0], I.High[0], I.Low[0], I.Close[0], I.Volume[0], I.VolumeBid[0], I.VolumeAsk[0], I.OpenInterest[0], H, L));
}
и ReadData
Код: Выделить всё
function Initialize()
{
IndicatorName = "ReadData_X";
PriceStudy = true;
AddInput("I", Inputs.Candle);
AddParameter("DataSlot", 0);
AddSeries("H", DrawAs.Custom, Color.Red);
AddSeries("L", DrawAs.Custom, Color.Green);
}
function Evaluate()
{
if (DataSlot == 0) return;
string Path = @"DataSlot" + (int)DataSlot + "\\";
System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(Path);
if (!dirInfo.Exists) dirInfo.Create();
string Ticker = Input.VirtualSecurity.Split('=')[0];
string FileName = String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}",
Ticker, BarDate().Year, BarDate().Month, BarDate().Day, BarTime().Hours, BarTime().Minutes, 0);
var URL = Path + FileName;
string S = "";
if (System.IO.File.Exists(URL))
{
System.IO.StreamReader output = new System.IO.StreamReader(URL);
while (!output.EndOfStream) S += output.ReadLine();
output.Close();
}
string[] Bar = S.Split(';');
// бар найден
if (Bar.Count() > 3)
{
H[1] = double.Parse(Bar[8]);
L[1] = double.Parse(Bar[9]);
H.DrawArrowDown(Color.Red, LineStyles.Solid, 10, Color.Red, 10);
L.DrawArrowUp(Color.Green, LineStyles.Solid, 10, Color.Green, 10);
} // count > 3
}