SATL v2 by footon
44315 downloads / 3467 views / Created: 24.05.2013 Average Rating: 0
Comments
//==============================================================
// Forex Strategy Builder
// Copyright (c) Miroslav Popov. All rights reserved.
//==============================================================
// THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE.
//==============================================================
using System;
using System.Drawing;
using ForexStrategyBuilder.Infrastructure.Entities;
using ForexStrategyBuilder.Infrastructure.Enums;
using ForexStrategyBuilder.Infrastructure.Interfaces;
namespace ForexStrategyBuilder.Indicators.Store
{
public class SATL_V2 : Indicator
{
public SATL_V2()
{
IndicatorName = "SATL v2";
PossibleSlots = SlotTypes.Open | SlotTypes.OpenFilter | SlotTypes.Close | SlotTypes.CloseFilter;
IndicatorAuthor = "Footon";
IndicatorVersion = "2.0";
IndicatorDescription = "Footon's indi corner: custom indicators for FSB and FST.";
}
public override void Initialize(SlotTypes slotType)
{
SlotType = slotType;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
if (SlotType == SlotTypes.Open)
IndParam.ListParam[0].ItemList = new string[]
{
"Enter the market at the Moving Average"
};
else if (SlotType == SlotTypes.OpenFilter)
IndParam.ListParam[0].ItemList = new string[]
{
"The Moving Average rises",
"The Moving Average falls",
"The bar opens above the Moving Average",
"The bar opens below the Moving Average",
"The bar opens above the Moving Average after opening below it",
"The bar opens below the Moving Average after opening above it",
"The position opens above the Moving Average",
"The position opens below the Moving Average",
};
else if (SlotType == SlotTypes.Close)
IndParam.ListParam[0].ItemList = new string[]
{
"Exit the market at the Moving Average"
};
else if (SlotType == SlotTypes.CloseFilter)
IndParam.ListParam[0].ItemList = new string[]
{
"The Moving Average rises",
"The Moving Average falls",
"The bar closes below the Moving Average",
"The bar closes above the Moving Average",
};
else
IndParam.ListParam[0].ItemList = new string[]
{
"Not Defined"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the Moving Average.";
/*IndParam.ListParam[1].Caption = "Smoothing method";
IndParam.ListParam[1].ItemList = Enum.GetNames(typeof(MAMethod));
IndParam.ListParam[1].Index = (int)MAMethod.Simple;
IndParam.ListParam[1].Text = IndParam.ListParam[1].ItemList[IndParam.ListParam[1].Index];
IndParam.ListParam[1].Enabled = true;
IndParam.ListParam[1].ToolTip = "The smoothing method of Moving Average.";*/
IndParam.ListParam[2].Caption = "Base price";
IndParam.ListParam[2].ItemList = Enum.GetNames(typeof(BasePrice));
IndParam.ListParam[2].Index = (int)BasePrice.Close;
IndParam.ListParam[2].Text = IndParam.ListParam[2].ItemList[IndParam.ListParam[2].Index];
IndParam.ListParam[2].Enabled = true;
IndParam.ListParam[2].ToolTip = "The price the Moving Average is based on.";
// The NumericUpDown parameters
/*IndParam.NumParam[0].Caption = "Period";
IndParam.NumParam[0].Value = 14;
IndParam.NumParam[0].Min = 1;
IndParam.NumParam[0].Max = 200;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The Moving Average period.";
IndParam.NumParam[1].Caption = "Shift";
IndParam.NumParam[1].Value = 0;
IndParam.NumParam[1].Min = 0;
IndParam.NumParam[1].Max = 200;
IndParam.NumParam[1].Enabled = true;
IndParam.NumParam[1].ToolTip = "How many bars to shift with.";*/
// The CheckBox parameters
IndParam.CheckParam[0].Caption = "Use previous bar value";
IndParam.CheckParam[0].Enabled = true;
IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar.";
return;
}
public override void Calculate(IDataSet dataSet)
{
DataSet = dataSet;
// Reading the parameters
int iPrvs = IndParam.CheckParam[0].Checked ? 1 : 0;
BasePrice basePrice = (BasePrice)IndParam.ListParam[2].Index;
//int firstbar = Convert.ToInt32(LongPeriod + ShortPeriod + ExtraTimeForward);
int iFirstBar = 70 + iPrvs;
double[] adBasePrice = Price(basePrice);
double[] SATLBuffer = new double[Bars];
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
SATLBuffer[iBar]=
0.0982862174*adBasePrice[iBar-0]
+0.0975682269*adBasePrice[iBar-1]
+0.0961401078*adBasePrice[iBar-2]
+0.0940230544*adBasePrice[iBar-3]
+0.0912437090*adBasePrice[iBar-4]
+0.0878391006*adBasePrice[iBar-5]
+0.0838544303*adBasePrice[iBar-6]
+0.0793406350*adBasePrice[iBar-7]
+0.0743569346*adBasePrice[iBar-8]
+0.0689666682*adBasePrice[iBar-9]
+0.0632381578*adBasePrice[iBar-10]
+0.0572428925*adBasePrice[iBar-11]
+0.0510534242*adBasePrice[iBar-12]
+0.0447468229*adBasePrice[iBar-13]
+0.0383959950*adBasePrice[iBar-14]
+0.0320735368*adBasePrice[iBar-15]
+0.0258537721*adBasePrice[iBar-16]
+0.0198005183*adBasePrice[iBar-17]
+0.0139807863*adBasePrice[iBar-18]
+0.0084512448*adBasePrice[iBar-19]
+0.0032639979*adBasePrice[iBar-20]
-0.0015350359*adBasePrice[iBar-21]
-0.0059060082*adBasePrice[iBar-22]
-0.0098190256*adBasePrice[iBar-23]
-0.0132507215*adBasePrice[iBar-24]
-0.0161875265*adBasePrice[iBar-25]
-0.0186164872*adBasePrice[iBar-26]
-0.0205446727*adBasePrice[iBar-27]
-0.0219739146*adBasePrice[iBar-28]
-0.0229204861*adBasePrice[iBar-29]
-0.0234080863*adBasePrice[iBar-30]
-0.0234566315*adBasePrice[iBar-31]
-0.0231017777*adBasePrice[iBar-32]
-0.0223796900*adBasePrice[iBar-33]
-0.0213300463*adBasePrice[iBar-34]
-0.0199924534*adBasePrice[iBar-35]
-0.0184126992*adBasePrice[iBar-36]
-0.0166377699*adBasePrice[iBar-37]
-0.0147139428*adBasePrice[iBar-38]
-0.0126796776*adBasePrice[iBar-39]
-0.0105938331*adBasePrice[iBar-40]
-0.0084736770*adBasePrice[iBar-41]
-0.0063841850*adBasePrice[iBar-42]
-0.0043466731*adBasePrice[iBar-43]
-0.0023956944*adBasePrice[iBar-44]
-0.0005535180*adBasePrice[iBar-45]
+0.0011421469*adBasePrice[iBar-46]
+0.0026845693*adBasePrice[iBar-47]
+0.0040471369*adBasePrice[iBar-48]
+0.0052380201*adBasePrice[iBar-49]
+0.0062194591*adBasePrice[iBar-50]
+0.0070340085*adBasePrice[iBar-51]
+0.0076266453*adBasePrice[iBar-52]
+0.0080376628*adBasePrice[iBar-53]
+0.0083037666*adBasePrice[iBar-54]
+0.0083694798*adBasePrice[iBar-55]
+0.0082901022*adBasePrice[iBar-56]
+0.0080741359*adBasePrice[iBar-57]
+0.0077543820*adBasePrice[iBar-58]
+0.0073260526*adBasePrice[iBar-59]
+0.0068163569*adBasePrice[iBar-60]
+0.0062325477*adBasePrice[iBar-61]
+0.0056078229*adBasePrice[iBar-62]
+0.0049516078*adBasePrice[iBar-63]
+0.0161380976*adBasePrice[iBar-64];
}
// Saving the components
if (SlotType == SlotTypes.Open || SlotType == SlotTypes.Close)
{
Component = new IndicatorComp[2];
Component[1] = new IndicatorComp();
Component[1].Value = new double[Bars];
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{ // Covers the cases when the price can pass through the MA without a signal
double dValue = SATLBuffer[iBar - iPrvs]; // Current value
double dValue1 = SATLBuffer[iBar - iPrvs - 1]; // Previous value
double dTempVal = dValue;
if ((dValue1 > High[iBar - 1] && dValue < Open[iBar]) || // The Open price jumps above the indicator
(dValue1 < Low[iBar - 1] && dValue > Open[iBar]) || // The Open price jumps below the indicator
(Close[iBar - 1] < dValue && dValue < Open[iBar]) || // The Open price is in a positive gap
(Close[iBar - 1] > dValue && dValue > Open[iBar])) // The Open price is in a negative gap
dTempVal = Open[iBar];
Component[1].Value[iBar] = dTempVal; // Entry or exit value
}
}
else
{
Component = new IndicatorComp[3];
Component[1] = new IndicatorComp();
Component[1].ChartType = IndChartType.NoChart;
Component[1].FirstBar = iFirstBar;
Component[1].Value = new double[Bars];
Component[2] = new IndicatorComp();
Component[2].ChartType = IndChartType.NoChart;
Component[2].FirstBar = iFirstBar;
Component[2].Value = new double[Bars];
}
Component[0] = new IndicatorComp();
Component[0].CompName = "MA Value";
Component[0].DataType = IndComponentType.IndicatorValue;
Component[0].ChartType = IndChartType.Line;
Component[0].ChartColor = Color.Red;
Component[0].FirstBar = iFirstBar;
Component[0].Value = SATLBuffer;
if (SlotType == SlotTypes.Open)
{
Component[1].CompName = "Position opening price";
Component[1].DataType = IndComponentType.OpenPrice;
}
else if (SlotType == SlotTypes.OpenFilter)
{
Component[1].DataType = IndComponentType.AllowOpenLong;
Component[1].CompName = "Is long entry allowed";
Component[2].DataType = IndComponentType.AllowOpenShort;
Component[2].CompName = "Is short entry allowed";
}
else if (SlotType == SlotTypes.Close)
{
Component[1].CompName = "Position closing price";
Component[1].DataType = IndComponentType.ClosePrice;
}
else if (SlotType == SlotTypes.CloseFilter)
{
Component[1].DataType = IndComponentType.ForceCloseLong;
Component[1].CompName = "Close out long position";
Component[2].DataType = IndComponentType.ForceCloseShort;
Component[2].CompName = "Close out short position";
}
if (SlotType == SlotTypes.OpenFilter || SlotType == SlotTypes.CloseFilter)
{
switch (IndParam.ListParam[0].Text)
{
case "The Moving Average rises":
IndicatorRisesLogic(iFirstBar, iPrvs, SATLBuffer, ref Component[1], ref Component[2]);
break;
case "The Moving Average falls":
IndicatorFallsLogic(iFirstBar, iPrvs, SATLBuffer, ref Component[1], ref Component[2]);
break;
case "The bar opens above the Moving Average":
BarOpensAboveIndicatorLogic(iFirstBar, iPrvs, SATLBuffer, ref Component[1], ref Component[2]);
break;
case "The bar opens below the Moving Average":
BarOpensBelowIndicatorLogic(iFirstBar, iPrvs, SATLBuffer, ref Component[1], ref Component[2]);
break;
case "The bar opens above the Moving Average after opening below it":
BarOpensAboveIndicatorAfterOpeningBelowLogic(iFirstBar, iPrvs, SATLBuffer, ref Component[1], ref Component[2]);
break;
case "The bar opens below the Moving Average after opening above it":
BarOpensBelowIndicatorAfterOpeningAboveLogic(iFirstBar, iPrvs, SATLBuffer, ref Component[1], ref Component[2]);
break;
case "The position opens above the Moving Average":
Component[0].PosPriceDependence = PositionPriceDependence.BuyHigherSellLower;
Component[0].UsePreviousBar = iPrvs;
Component[1].DataType = IndComponentType.Other;
Component[1].ShowInDynInfo = false;
Component[2].DataType = IndComponentType.Other;
Component[2].ShowInDynInfo = false;
break;
case "The position opens below the Moving Average":
Component[0].PosPriceDependence = PositionPriceDependence.BuyLowerSelHigher;
Component[0].UsePreviousBar = iPrvs;
Component[1].DataType = IndComponentType.Other;
Component[1].ShowInDynInfo = false;
Component[2].DataType = IndComponentType.Other;
Component[2].ShowInDynInfo = false;
break;
case "The bar closes below the Moving Average":
BarClosesBelowIndicatorLogic(iFirstBar, iPrvs, SATLBuffer, ref Component[1], ref Component[2]);
break;
case "The bar closes above the Moving Average":
BarClosesAboveIndicatorLogic(iFirstBar, iPrvs, SATLBuffer, ref Component[1], ref Component[2]);
break;
default:
break;
}
}
return;
}
///
/// Sets the indicator logic description
///
public override void SetDescription()
{
EntryPointLongDescription = "at the " + ToString();
EntryPointShortDescription = "at the " + ToString();
ExitPointLongDescription = "at the " + ToString();
ExitPointShortDescription = "at the " + ToString();
switch (IndParam.ListParam[0].Text)
{
case "The Moving Average rises":
EntryFilterLongDescription = "the " + ToString() + " rises";
EntryFilterShortDescription = "the " + ToString() + " falls";
ExitFilterLongDescription = "the " + ToString() + " rises";
ExitFilterShortDescription = "the " + ToString() + " falls";
break;
case "The Moving Average falls":
EntryFilterLongDescription = "the " + ToString() + " falls";
EntryFilterShortDescription = "the " + ToString() + " rises";
ExitFilterLongDescription = "the " + ToString() + " falls";
ExitFilterShortDescription = "the " + ToString() + " rises";
break;
case "The bar opens above the Moving Average":
EntryFilterLongDescription = "the bar opens above the " + ToString();
EntryFilterShortDescription = "the bar opens below the " + ToString();
break;
case "The bar opens below the Moving Average":
EntryFilterLongDescription = "the bar opens below the " + ToString();
EntryFilterShortDescription = "the bar opens above the " + ToString();
break;
case "The position opens above the Moving Average":
EntryFilterLongDescription = "the position opening price is higher than the " + ToString();
EntryFilterShortDescription = "the position opening price is lower than the " + ToString();
break;
case "The position opens below the Moving Average":
EntryFilterLongDescription = "the position opening price is lower than the " + ToString();
EntryFilterShortDescription = "the position opening price is higher than the " + ToString();
break;
case "The bar opens above the Moving Average after opening below it":
EntryFilterLongDescription = "the bar opens above the " + ToString() + " after opening below it";
EntryFilterShortDescription = "the bar opens below the " + ToString() + " after opening above it";
break;
case "The bar opens below the Moving Average after opening above it":
EntryFilterLongDescription = "the bar opens below the " + ToString() + " after opening above it";
EntryFilterShortDescription = "the bar opens above the " + ToString() + " after opening below it";
break;
case "The bar closes above the Moving Average":
ExitFilterLongDescription = "the bar closes above the " + ToString();
ExitFilterShortDescription = "the bar closes below the " + ToString();
break;
case "The bar closes below the Moving Average":
ExitFilterLongDescription = "the bar closes below the " + ToString();
ExitFilterShortDescription = "the bar closes above the " + ToString();
break;
default:
break;
}
return;
}
///
/// Indicator to string
///
public override string ToString()
{
string sString = IndicatorName +
(IndParam.CheckParam[0].Checked ? "* (" : " (") +
IndParam.ListParam[1].Text + ", " + // Method
IndParam.ListParam[2].Text + ", " + // Price
IndParam.NumParam[0].ValueToString + ", " + // MA period
IndParam.NumParam[1].ValueToString + ")"; // MA shift
return sString;
}
}
}
//+--------------------------------------------------------------------+ //| Copyright: (C) 2014, Miroslav Popov - All rights reserved! | //| Website: http://forexsb.com/ | //| Support: http://forexsb.com/forum/ | //| License: Proprietary under the following circumstances: | //| | //| This code is a part of Forex Strategy Builder. It is free for | //| use as an integral part of Forex Strategy Builder. | //| One can modify it in order to improve the code or to fit it for | //| personal use. This code or any part of it cannot be used in | //| another applications without a permission. Contact information | //| cannot be changed. | //| | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | //| | //| In no event shall the author be liable for any damages whatsoever | //| (including, without limitation, incidental, direct, indirect and | //| consequential damages, damages for loss of business profits, | //| business interruption, loss of business information, or other | //| pecuniary loss) arising out of the use or inability to use this | //| product, even if advised of the possibility of such damages. | //+--------------------------------------------------------------------+ #property copyright "Copyright 2014, Miroslav Popov" #property link "http://forexsb.com" #property version "1.00" #property strict #include <Forexsb.com/Indicator.mqh> #include <Forexsb.com/Enumerations.mqh> //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class SATLv2 : public Indicator { public: SATLv2(SlotTypes slotType) { SlotType=slotType; IndicatorName="SATL v2"; WarningMessage = ""; IsAllowLTF = true; ExecTime = ExecutionTime_DuringTheBar; IsSeparateChart = false; IsDiscreteValues = false; IsDeafultGroupAll = false; } virtual void Calculate(DataSet &dataSet); }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void SATLv2::Calculate(DataSet &dataSet) { Data=GetPointer(dataSet); // Reading the parameters int iPrvs=CheckParam[0].Checked ? 1 : 0; BasePrice basePrice=(BasePrice)ListParam[2].Index; int firstBar=70+iPrvs; double adBasePrice[]; Price(basePrice,adBasePrice); double satlBuffer[]; ArrayResize(satlBuffer,Data.Bars); ArrayInitialize(satlBuffer,0); for(int bar=firstBar; bar<Data.Bars; bar++) { satlBuffer[bar]= 0.0982862174*adBasePrice[bar-0] +0.0975682269*adBasePrice[bar-1] +0.0961401078*adBasePrice[bar-2] +0.0940230544*adBasePrice[bar-3] +0.0912437090*adBasePrice[bar-4] +0.0878391006*adBasePrice[bar-5] +0.0838544303*adBasePrice[bar-6] +0.0793406350*adBasePrice[bar-7] +0.0743569346*adBasePrice[bar-8] +0.0689666682*adBasePrice[bar-9] +0.0632381578*adBasePrice[bar-10] +0.0572428925*adBasePrice[bar-11] +0.0510534242*adBasePrice[bar-12] +0.0447468229*adBasePrice[bar-13] +0.0383959950*adBasePrice[bar-14] +0.0320735368*adBasePrice[bar-15] +0.0258537721*adBasePrice[bar-16] +0.0198005183*adBasePrice[bar-17] +0.0139807863*adBasePrice[bar-18] +0.0084512448*adBasePrice[bar-19] +0.0032639979*adBasePrice[bar-20] -0.0015350359*adBasePrice[bar-21] -0.0059060082*adBasePrice[bar-22] -0.0098190256*adBasePrice[bar-23] -0.0132507215*adBasePrice[bar-24] -0.0161875265*adBasePrice[bar-25] -0.0186164872*adBasePrice[bar-26] -0.0205446727*adBasePrice[bar-27] -0.0219739146*adBasePrice[bar-28] -0.0229204861*adBasePrice[bar-29] -0.0234080863*adBasePrice[bar-30] -0.0234566315*adBasePrice[bar-31] -0.0231017777*adBasePrice[bar-32] -0.0223796900*adBasePrice[bar-33] -0.0213300463*adBasePrice[bar-34] -0.0199924534*adBasePrice[bar-35] -0.0184126992*adBasePrice[bar-36] -0.0166377699*adBasePrice[bar-37] -0.0147139428*adBasePrice[bar-38] -0.0126796776*adBasePrice[bar-39] -0.0105938331*adBasePrice[bar-40] -0.0084736770*adBasePrice[bar-41] -0.0063841850*adBasePrice[bar-42] -0.0043466731*adBasePrice[bar-43] -0.0023956944*adBasePrice[bar-44] -0.0005535180*adBasePrice[bar-45] +0.0011421469*adBasePrice[bar-46] +0.0026845693*adBasePrice[bar-47] +0.0040471369*adBasePrice[bar-48] +0.0052380201*adBasePrice[bar-49] +0.0062194591*adBasePrice[bar-50] +0.0070340085*adBasePrice[bar-51] +0.0076266453*adBasePrice[bar-52] +0.0080376628*adBasePrice[bar-53] +0.0083037666*adBasePrice[bar-54] +0.0083694798*adBasePrice[bar-55] +0.0082901022*adBasePrice[bar-56] +0.0080741359*adBasePrice[bar-57] +0.0077543820*adBasePrice[bar-58] +0.0073260526*adBasePrice[bar-59] +0.0068163569*adBasePrice[bar-60] +0.0062325477*adBasePrice[bar-61] +0.0056078229*adBasePrice[bar-62] +0.0049516078*adBasePrice[bar-63] +0.0161380976*adBasePrice[bar-64]; } // Saving the components if(SlotType==SlotTypes_Open || SlotType==SlotTypes_Close) { ArrayResize(Component[1].Value,Data.Bars); for(int iBar=firstBar; iBar<Data.Bars; iBar++) { // Covers the cases when the price can pass through the MA without a signal double dValue=satlBuffer[iBar-iPrvs]; // Current value double dValue1=satlBuffer[iBar-iPrvs-1]; // Previous value double dTempVal=dValue; if((dValue1 > Data.High[iBar - 1] && dValue < Data.Open[iBar]) || // The Data.Open price jumps above the indicator (dValue1 < Data.Low[iBar - 1] && dValue > Data.Open[iBar]) || // The Data.Open price jumps below the indicator (Data.Close[iBar-1]<dValue && dValue<Data.Open[iBar]) || // The Data.Open price is in a positive gap (Data.Close[iBar-1]>dValue && dValue>Data.Open[iBar])) // The Data.Open price is in a negative gap dTempVal=Data.Open[iBar]; Component[1].Value[iBar]=dTempVal; // Entry or exit value } } else { ArrayResize(Component[1].Value,Data.Bars); Component[1].FirstBar=firstBar; ArrayResize(Component[2].Value,Data.Bars); Component[2].FirstBar=firstBar; } ArrayResize(Component[0].Value,Data.Bars); Component[0].CompName = "MA Value"; Component[0].DataType = IndComponentType_IndicatorValue; Component[0].FirstBar = firstBar; ArrayCopy(Component[0].Value,satlBuffer); if(SlotType==SlotTypes_Open) { Component[1].CompName = "Position opening price"; Component[1].DataType = IndComponentType_OpenPrice; } else if(SlotType==SlotTypes_OpenFilter) { Component[1].DataType = IndComponentType_AllowOpenLong; Component[1].CompName = "Is long entry allowed"; Component[2].DataType = IndComponentType_AllowOpenShort; Component[2].CompName = "Is short entry allowed"; } else if(SlotType==SlotTypes_Close) { Component[1].CompName = "Position closing price"; Component[1].DataType = IndComponentType_ClosePrice; } else if(SlotType==SlotTypes_CloseFilter) { Component[1].DataType = IndComponentType_ForceCloseLong; Component[1].CompName = "Close out long position"; Component[2].DataType = IndComponentType_ForceCloseShort; Component[2].CompName = "Close out short position"; } if(SlotType==SlotTypes_OpenFilter || SlotType==SlotTypes_CloseFilter) { if(ListParam[0].Text=="The Moving Average rises") { IndicatorRisesLogic(firstBar,iPrvs,satlBuffer,Component[1],Component[2]); } else if(ListParam[0].Text=="The Moving Average falls") { IndicatorFallsLogic(firstBar,iPrvs,satlBuffer,Component[1],Component[2]); } else if(ListParam[0].Text=="The bar opens above the Moving Average") { BarOpensAboveIndicatorLogic(firstBar,iPrvs,satlBuffer,Component[1],Component[2]); } else if(ListParam[0].Text=="The bar opens below the Moving Average") { BarOpensBelowIndicatorLogic(firstBar,iPrvs,satlBuffer,Component[1],Component[2]); } else if(ListParam[0].Text=="The bar opens above the Moving Average after opening below it") { BarOpensAboveIndicatorAfterOpeningBelowLogic(firstBar,iPrvs,satlBuffer,Component[1], Component[2]); } else if(ListParam[0].Text=="The bar opens below the Moving Average after opening above it") { BarOpensBelowIndicatorAfterOpeningAboveLogic(firstBar,iPrvs,satlBuffer,Component[1], Component[2]); } else if(ListParam[0].Text=="The position opens above the Moving Average") { Component[0].PosPriceDependence=PositionPriceDependence_BuyHigherSellLower; Component[0].UsePreviousBar=iPrvs; Component[1].DataType=IndComponentType_Other; Component[1].ShowInDynInfo=false; Component[2].DataType=IndComponentType_Other; Component[2].ShowInDynInfo=false; } else if(ListParam[0].Text=="The position opens below the Moving Average") { Component[0].PosPriceDependence=PositionPriceDependence_BuyLowerSelHigher; Component[0].UsePreviousBar=iPrvs; Component[1].DataType=IndComponentType_Other; Component[1].ShowInDynInfo=false; Component[2].DataType=IndComponentType_Other; Component[2].ShowInDynInfo=false; } else if(ListParam[0].Text=="The bar closes below the Moving Average") { BarClosesBelowIndicatorLogic(firstBar,iPrvs,satlBuffer,Component[1],Component[2]); } else if(ListParam[0].Text=="The bar closes above the Moving Average") { BarClosesAboveIndicatorLogic(firstBar,iPrvs,satlBuffer,Component[1],Component[2]); } } } //+------------------------------------------------------------------+
Risk warning: Forex, spread bets and CFD are leveraged products. They may not be suitable for you as they carry a high degree of risk to your capital and you can lose more than your initial investment. You should ensure you understand all of the risks.
Copyright © 2006 - 2024, Forex Software Ltd.;
Copyright © 2006 - 2024, Forex Software Ltd.;