|
Attention! Read the forum rules carefully before posting a topic.
Try to find an answer in Wiki before asking a question. Submit programming questions in this forum only. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
Cycle Identifier |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Mon 14 Nov, 2011, 11:19
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
hello API support! You can help me, please to convert indicator to standard Custom indicator.
thank You Max
[code] package jforex.converted; import java.awt.Color; import com.dukascopy.api.*; import com.dukascopy.connector.engine.*; import com.dukascopy.connector.engine.Properties; import com.dukascopy.connector.engine.IndicatorBuffer;
@RequiresFullAccess @Library("C:/Windows/temp/ConverterClient 1.1/libs/MQL4Connector-2.6.38.2.jar") public class CycleIdentifier2 extends MQL4ConnectorIndicator {
protected void initProperties() { if (properties == null) { properties = new Properties(); } properties.setProperty("indicator_maximum","1.2"); properties.setProperty("indicator_color5","Brown"); properties.setProperty("indicator_buffers","6"); properties.setProperty("indicator_minimum","-1.2"); properties.setProperty("indicator_color3","Red"); properties.setProperty("indicator_color4","DarkGreen"); properties.setProperty("link",""); properties.setProperty("indicator_separate_window","true"); properties.setProperty("indicator_color2","Lime"); properties.setProperty("indicator_color1","DarkGray"); properties.setProperty("copyright","");
} protected Color indicator_color5 = Brown; protected Color indicator_color3 = Red; protected Color indicator_color4 = DarkGreen; protected Color indicator_color2 = Lime; protected Color indicator_color1 = DarkGray; @Configurable("") public int PriceActionFilter=toInt(1); @Configurable("") public int Length=toInt(3); @Configurable("") public int MajorCycleStrength=toInt(4); @Configurable("") public boolean UseCycleFilter=Bool(false); @Configurable("") public int UseFilterSMAorRSI=toInt(1); @Configurable("") public int FilterStrengthSMA=toInt(12); @Configurable("") public int FilterStrengthRSI=toInt(21); @IndicatorBuffer ("") public double[] LineBuffer = new double[0]; @IndicatorBuffer ("") public double[] MajorCycleBuy = new double[0]; @IndicatorBuffer ("") public double[] MajorCycleSell = new double[0]; @IndicatorBuffer ("") public double[] MinorCycleBuy = new double[0]; @IndicatorBuffer ("") public double[] MinorCycleSell = new double[0]; @IndicatorBuffer ("") public double[] ZL1 = new double[0]; double CyclePrice=toDouble(0.0); double Strength=toDouble(0.0); double SweepA=toDouble(0.0); double SweepB=toDouble(0.0); int Switch=toInt(0); int Switch2=toInt(0); int SwitchA=toInt(0); int SwitchB=toInt(0); int SwitchC=toInt(0); int SwitchD=toInt(0); int SwitchE=toInt(0); int SwitchAA=toInt(0); int SwitchBB=toInt(0); double Price1BuyA=toDouble(0.0); double Price2BuyA=toDouble(0.0); double Price1BuyB=toDouble(1.0); double Price2BuyB=toDouble(1.0); double Price1SellA=toDouble(0.0); double Price2SellA=toDouble(0.0); double Price1SellB=toDouble(0.0); double Price2SellB=toDouble(0.0); boolean ActiveSwitch=Bool(true); boolean BuySwitchA=Bool(false); boolean BuySwitchB=Bool(false); boolean SellSwitchA=Bool(false); boolean SellSwitchB=Bool(false); int BuySellFac=toInt(1); boolean Condition1 = true; boolean Condition2 = true; boolean Condition3 = true; boolean Condition6 = true;
public int init() throws JFException {
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(0,LineBuffer); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3); SetIndexBuffer(1,MajorCycleBuy); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,3); SetIndexBuffer(2,MajorCycleSell); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1); SetIndexBuffer(3,MinorCycleBuy); SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID,1); SetIndexBuffer(4,MinorCycleSell); SetIndexStyle(5,DRAW_NONE); SetIndexBuffer(5,ZL1); SetIndexEmptyValue(1,0.0); SetIndexEmptyValue(2,0.0); SetIndexEmptyValue(3,0.0); SetIndexEmptyValue(4,0.0); SetIndexEmptyValue(5,0.0); if(true)return toInt(0);return 0; }
public int deinit() throws JFException {
if(true)return toInt(0);return 0; }
public int start() throws JFException { int counted_bars = 0; int position = 0; int rnglength = 0; double range=toDouble(0.0); double srange=toDouble(0.0); int pos=toInt(position); int j = 0; int i=toInt(0); int posr = 0; int BarNumber = 0; double cyclePrice1 = 0.0; double cyclePrice2 = 0.0; double cyclePrice3 = 0.0; double cyclePrice4 = 0.0;
resetValues();
counted_bars = toInt(IndicatorCounted());
if (counted_bars<0){
if(true)return toInt(-1);} position = toInt(Bars-counted_bars);
if (position<0){
position = toInt(0); } rnglength = toInt(250);
for(pos=(int)position;pos>=0;pos--){ srange = toDouble(0.0); j = toInt(0);
for(i=(int)0;i<rnglength;i++){ j++; posr = toInt(pos+i);
if (posr>=Bars){ break;} srange = toDouble(srange+(High(posr)-Low(posr))); } range = toDouble(srange/j*Length); BarNumber = toInt(Bars-pos); if (BarNumber<0){ BarNumber = toInt(0); } CyclePrice = toDouble(iMA(null,0,PriceActionFilter,0,MODE_SMMA,PRICE_CLOSE,pos)); if (UseFilterSMAorRSI==1){ ZL1[toInt(pos)]=toDouble(ZeroLag(CyclePrice,FilterStrengthSMA,pos)); } if (UseFilterSMAorRSI==2){ ZL1[toInt(pos)]=toDouble(ZeroLag(iRSI(null,0,14,CyclePrice,FilterStrengthRSI),FilterStrengthRSI,pos)); } if (ZL1[pos]>ZL1[pos+1]){ SwitchC = toInt(1); } if (ZL1[pos]<ZL1[pos+1]){ SwitchC = toInt(2); } if (BarNumber<=1){ if (Strength==0){ SweepA = toDouble(range); } else { SweepA = toDouble(Strength); } Price1BuyA = toDouble(CyclePrice); Price1SellA = toDouble(CyclePrice); } if (BarNumber>1){ if (Switch>-1){ if (CyclePrice<Price1BuyA){ if (UseCycleFilter&&(SwitchC==2)&&BuySwitchA){ MinorCycleBuy[toInt(pos+BarNumber-Price1BuyB)]=toDouble(0); LineBuffer[toInt(pos+BarNumber-Price1BuyB)]=toDouble(0); } if (!UseCycleFilter&&BuySwitchA){ MinorCycleBuy[toInt(pos+BarNumber-Price1BuyB)]=toDouble(0); LineBuffer[toInt(pos+BarNumber-Price1BuyB)]=toDouble(0); } Price1BuyA = toDouble(CyclePrice); Price1BuyB = toDouble(BarNumber); BuySwitchA = Bool(true); } else if (CyclePrice>Price1BuyA){ SwitchA = toInt(BarNumber-Price1BuyB); if (!UseCycleFilter){ MinorCycleBuy[toInt(pos+SwitchA)]=toDouble(-1); LineBuffer[toInt(pos+SwitchA)]=toDouble(-1); } if (UseCycleFilter&&SwitchC==1){ MinorCycleBuy[toInt(pos+SwitchA)]=toDouble(-1); LineBuffer[toInt(pos+SwitchA)]=toDouble(-1); SwitchD = toInt(1); } else { SwitchD = toInt(0); } BuySwitchA = Bool(true); cyclePrice1 = toDouble(iMA(null,0,PriceActionFilter,0,MODE_SMMA,PRICE_CLOSE,pos+SwitchA)); if (ActiveSwitch){ Condition1 = Bool(CyclePrice-cyclePrice1>=SweepA); } else { Condition1 = Bool(CyclePrice>=cyclePrice1*(1+SweepA/1000)); } if (Condition1&&SwitchA>=BuySellFac){ Switch = toInt(-1); Price1SellA = toDouble(CyclePrice); Price1SellB = toDouble(BarNumber); SellSwitchA = Bool(false); BuySwitchA = Bool(false); }}} if (Switch<1){ if (CyclePrice>Price1SellA){ if (UseCycleFilter&&SwitchC==1&&SellSwitchA){ MinorCycleSell[toInt(pos+BarNumber-Price1SellB)]=toDouble(0); LineBuffer[toInt(pos+BarNumber-Price1SellB)]=toDouble(0); } if (!UseCycleFilter&&SellSwitchA){ MinorCycleSell[toInt(pos+BarNumber-Price1SellB)]=toDouble(0); LineBuffer[toInt(pos+BarNumber-Price1SellB)]=toDouble(0); } Price1SellA = toDouble(CyclePrice); Price1SellB = toDouble(BarNumber); SellSwitchA = Bool(true); } else if (CyclePrice<Price1SellA){ SwitchA = toInt(BarNumber-Price1SellB); if (!UseCycleFilter){ MinorCycleSell[toInt(pos+SwitchA)]=toDouble(1); LineBuffer[toInt(pos+SwitchA)]=toDouble(1); } if (UseCycleFilter&&(SwitchC==2)){ MinorCycleSell[toInt(pos+SwitchA)]=toDouble(1); LineBuffer[toInt(pos+SwitchA)]=toDouble(1); SwitchD = toInt(2); } else { SwitchD = toInt(0); } SellSwitchA = Bool(true); cyclePrice2 = toDouble(iMA(null,0,PriceActionFilter,0,MODE_SMMA,PRICE_CLOSE,pos+SwitchA)); if (ActiveSwitch){ Condition1 = Bool((cyclePrice2-CyclePrice)>=SweepA); } else { Condition1 = Bool(CyclePrice<=(cyclePrice2*(1-SweepA/1000))); } if (Condition1&&SwitchA>=BuySellFac){ Switch = toInt(1); Price1BuyA = toDouble(CyclePrice); Price1BuyB = toDouble(BarNumber); SellSwitchA = Bool(false); BuySwitchA = Bool(false); }}}} LineBuffer[toInt(pos)]=toDouble(0); MinorCycleBuy[toInt(pos)]=toDouble(0); MinorCycleSell[toInt(pos)]=toDouble(0); if (BarNumber==1){ if (Strength==0){ SweepB = toDouble(range*MajorCycleStrength); } else { SweepB = toDouble(Strength*MajorCycleStrength); } Price2BuyA = toDouble(CyclePrice); Price2SellA = toDouble(CyclePrice); } if (BarNumber>1){ if (Switch2>-1){ if (CyclePrice<Price2BuyA){ if (UseCycleFilter&&SwitchC==2&&BuySwitchB){ MajorCycleBuy[toInt(pos+BarNumber-Price2BuyB)]=toDouble(0); } if (!UseCycleFilter&&BuySwitchB){ MajorCycleBuy[toInt(pos+BarNumber-Price2BuyB)]=toDouble(0); } Price2BuyA = toDouble(CyclePrice); Price2BuyB = toDouble(BarNumber); BuySwitchB = Bool(true); } else if (CyclePrice>Price2BuyA){ SwitchB = toInt(BarNumber-Price2BuyB); if (!UseCycleFilter){ MajorCycleBuy[toInt(pos+SwitchB)]=toDouble(-1); } if (UseCycleFilter&&SwitchC==1){ MajorCycleBuy[toInt(pos+SwitchB)]=toDouble(-1); SwitchE = toInt(1); } else { SwitchE = toInt(0); } BuySwitchB = Bool(true); cyclePrice3 = toDouble(iMA(null,0,PriceActionFilter,0,MODE_SMMA,PRICE_CLOSE,pos+SwitchB)); if (ActiveSwitch){ Condition6 = Bool(CyclePrice-cyclePrice3>=SweepB); } else { Condition6 = Bool(CyclePrice>=cyclePrice3*(1+SweepB/1000)); } if (Condition6&&SwitchB>=BuySellFac){ Switch2 = toInt(-1); Price2SellA = toDouble(CyclePrice); Price2SellB = toDouble(BarNumber); SellSwitchB = Bool(false); BuySwitchB = Bool(false); }}} if (Switch2<1){ if (CyclePrice>Price2SellA){ if (UseCycleFilter&&SwitchC==1&&SellSwitchB){ MajorCycleSell[toInt(pos+BarNumber-Price2SellB)]=toDouble(0); } if (!UseCycleFilter&&SellSwitchB){ MajorCycleSell[toInt(pos+BarNumber-Price2SellB)]=toDouble(0); } Price2SellA = toDouble(CyclePrice); Price2SellB = toDouble(BarNumber); SellSwitchB = Bool(true); } else if (CyclePrice<Price2SellA){ SwitchB = toInt(BarNumber-Price2SellB); if (!UseCycleFilter){ MajorCycleSell[toInt(pos+SwitchB)]=toDouble(1); } if (UseCycleFilter&&SwitchC==2){ MajorCycleSell[toInt(pos+SwitchB)]=toDouble(1); SwitchE = toInt(2); } else { SwitchE = toInt(0); } SellSwitchB = Bool(true); cyclePrice4 = toDouble(iMA(null,0,PriceActionFilter,0,MODE_SMMA,PRICE_CLOSE,pos+SwitchB)); if (ActiveSwitch){ Condition6 = Bool(cyclePrice4-CyclePrice>=SweepB); } else { Condition6 = Bool(CyclePrice<=cyclePrice4*(1.0-SweepB/1000.0)); } if (Condition6&&SwitchB>=BuySellFac){ Switch2 = toInt(1); Price2BuyA = toDouble(CyclePrice); Price2BuyB = toDouble(BarNumber); SellSwitchB = Bool(false); BuySwitchB = Bool(false); }}}} LineBuffer[toInt(pos)]=toDouble(0); MajorCycleSell[toInt(pos)]=toDouble(0); MajorCycleBuy[toInt(pos)]=toDouble(0); } if(true)return toInt(0);return 0; } public void resetValues() throws JFException { CyclePrice = toDouble(0.0); Strength = toDouble(0.0); SweepA = toDouble(0.0); SweepB = toDouble(0.0); Switch = toInt(0); Switch2 = toInt(0); SwitchA = toInt(0); SwitchB = toInt(0); SwitchC = toInt(0); SwitchD = toInt(0); SwitchE = toInt(0); SwitchAA = toInt(0); SwitchBB = toInt(0); Price1BuyA = toDouble(0.0); Price2BuyA = toDouble(0.0); Price1BuyB = toDouble(1.0); Price2BuyB = toDouble(1.0); Price1SellA = toDouble(0.0); Price2SellA = toDouble(0.0); Price1SellB = toDouble(0.0); Price2SellB = toDouble(0.0); ActiveSwitch = Bool(true); BuySwitchA = Bool(false); BuySwitchB = Bool(false); SellSwitchA = Bool(false); SellSwitchB = Bool(false); BuySellFac = toInt(1); Condition1 = Bool(true); Condition2 = Bool(true); Condition3 = Bool(true); Condition6 = Bool(true); return ; } public double ZeroLag(Number price, Number length, Number pos) throws JFException {return ZeroLag(price.doubleValue(), length.intValue(), pos.intValue());} public double ZeroLag(Number price, boolean length, Number pos) throws JFException { return ZeroLag(price.doubleValue(), toInt(length), pos.intValue());} public double ZeroLag(Number price, Number length, boolean pos) throws JFException { return ZeroLag(price.doubleValue(), length.intValue(), toInt(pos));} public double ZeroLag(boolean price, Number length, Number pos) throws JFException { return ZeroLag(toDouble(price), length.intValue(), pos.intValue());} public double ZeroLag(boolean price, boolean length, boolean pos) throws JFException { return ZeroLag(toDouble(price), toInt(length), toInt(pos));} public double ZeroLag(Number price, boolean length, boolean pos) throws JFException { return ZeroLag(price.doubleValue(), toInt(length), toInt(pos));} public double ZeroLag(boolean price, Number length, boolean pos) throws JFException { return ZeroLag(toDouble(price), length.intValue(), toInt(pos));} public double ZeroLag(double price, int length, int pos) throws JFException { double aa = 0.0; double bb = 0.0; double CB = 0.0; double CC = 0.0; double CA = 0.0; double CD = 0.0; if (length<3){ if(true)return toDouble(price);} aa = toDouble(MathExp(-1.414*3.14159/length)); bb = toDouble(2*aa*MathCos(1.414*180/length)); CB = toDouble(bb); CC = toDouble(-aa*aa); CA = toDouble(1-CB-CC); CD = toDouble(CA*price+CB*ZL1[toInt(pos+1)]+CC*ZL1[toInt(pos+2)]); if(true)return toDouble(CD);return 0.0; }
/**/}; [/code]
|
|
|
|
 |
API Support
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Mon 14 Nov, 2011, 13:41
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
We created an indicator based on the code that you provided. package jforex.indicators;
import java.awt.Color; import java.text.DecimalFormat;
import com.dukascopy.api.IBar; import com.dukascopy.api.IConsole; import com.dukascopy.api.IIndicators.MaType; import com.dukascopy.api.indicators.*;
public class CycleIdentifierJForex implements IIndicator { private IndicatorInfo indicatorInfo; private InputParameterInfo[] inputParameterInfos; private OptInputParameterInfo[] optInputParameterInfos; private OutputParameterInfo[] outputParameterInfos; private double[][][] inputs = new double[1][][]; private int lookback = 300; private int buffer = 50; private double[][] outputs = new double[6][];
// opt inputs private int PriceActionFilter = 1; private int Length = 3; private int MajorCycleStrength = 4; private boolean UseCycleFilter = false; private int UseFilterSMAorRSI = 1; private int FilterStrengthSMA = 12; private int FilterStrengthRSI = 21;
// ind values double CyclePrice = (0.0); double Strength = (0.0); double SweepA = (0.0); double SweepB = (0.0); int Switch = (0); int Switch2 = (0); int SwitchA = (0); int SwitchB = (0); int SwitchC = (0); int SwitchD = (0); int SwitchE = (0); int SwitchAA = (0); int SwitchBB = (0); double Price1BuyA = (0.0); double Price2BuyA = (0.0); double Price1BuyB = (1.0); double Price2BuyB = (1.0); double Price1SellA = (0.0); double Price2SellA = (0.0); double Price1SellB = (0.0); double Price2SellB = (0.0); boolean ActiveSwitch = (true); boolean BuySwitchA = (false); boolean BuySwitchB = (false); boolean SellSwitchA = (false); boolean SellSwitchB = (false); int BuySellFac = 1; boolean Condition1 = true; boolean Condition2 = true; boolean Condition3 = true; boolean Condition6 = true;
// output buffers // TODO: reinit on every calculation? public double[] LineBuffer = new double[4000]; public double[] MajorCycleBuy = new double[4000]; public double[] MajorCycleSell = new double[4000]; public double[] MinorCycleBuy = new double[4000]; public double[] MinorCycleSell = new double[4000]; public double[] ZL1 = new double[4000];
private IConsole console; private IIndicator ma; private IIndicator rsi;
public static final int OPEN = 0; public static final int CLOSE = 1; public static final int HIGH = 2; public static final int LOW = 3; public static final int VOLUME = 4;
public void onStart(IIndicatorContext context) { indicatorInfo = new IndicatorInfo("CYCLE3", "Cycle identifier", "My indicators", false, false, false, 1, 7, 6); inputParameterInfos = new InputParameterInfo[] { new InputParameterInfo("Input data", InputParameterInfo.Type.PRICE) };
optInputParameterInfos = new OptInputParameterInfo[] { new OptInputParameterInfo("PriceActionFilter", OptInputParameterInfo.Type.OTHER, new IntegerRangeDescription(1, 0, 100, 1)), new OptInputParameterInfo("Length", OptInputParameterInfo.Type.OTHER, new IntegerRangeDescription(3, 0, 100, 1)), new OptInputParameterInfo("MajorCycleStrength", OptInputParameterInfo.Type.OTHER, new IntegerRangeDescription(4, 0, 100, 1)), new OptInputParameterInfo("UseCycleFilter", OptInputParameterInfo.Type.OTHER, new BooleanOptInputDescription(false)), new OptInputParameterInfo("UseFilterSMAorRSI", OptInputParameterInfo.Type.OTHER, new IntegerRangeDescription(1, 0, 100, 1)), new OptInputParameterInfo("FilterStrengthSMA", OptInputParameterInfo.Type.OTHER, new IntegerRangeDescription(12, 0, 100, 1)), new OptInputParameterInfo("FilterStrengthRSI", OptInputParameterInfo.Type.OTHER, new IntegerRangeDescription(21, 0, 100, 1))
}; outputParameterInfos = new OutputParameterInfo[] { new OutputParameterInfo("LineBuffer", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.LINE) {{ this.setColor(Color.DARK_GRAY); }}, new OutputParameterInfo("MajorCycleBuy", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.HISTOGRAM) {{ this.setColor(Color.GREEN); }}, new OutputParameterInfo("MajorCycleSell", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.HISTOGRAM) {{ this.setColor(Color.RED); }}, new OutputParameterInfo("MinorCycleBuy", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.HISTOGRAM) {{ this.setColor(Color.GREEN.darker().darker()); }}, new OutputParameterInfo("MinorCycleSell", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.HISTOGRAM) {{ this.setColor(Color.RED.darker().darker()); }}, new OutputParameterInfo("ZL1", OutputParameterInfo.Type.DOUBLE, OutputParameterInfo.DrawingStyle.LINE) {{ this.setShowOutput(false); }}
};
console = context.getConsole(); ma = context.getIndicatorsProvider().getIndicator("MA"); rsi = context.getIndicatorsProvider().getIndicator("RSI"); }
public IndicatorResult calculate(int startIndex, int endIndex) { // calculating startIndex taking into account lookback value if (startIndex - getLookback() < 0) { startIndex -= startIndex - getLookback(); } int i, j;
int counted_bars = 0; int position = 0; int rnglength = 0; double range = (0.0); double srange = (0.0); int pos = (position); // int j = 0; // int i = (0); int posr = 0; int BarNumber = 0; double cyclePrice1 = 0.0; double cyclePrice2 = 0.0; double cyclePrice3 = 0.0; double cyclePrice4 = 0.0; // TODO: check resetValues();
position = lookback - buffer; if (position < 0) { position = (0); } rnglength = (250);
// MA calculation ma.setOptInputParameter(0, PriceActionFilter); ma.setOptInputParameter(1, MaType.MAMA.ordinal()); ma.setInputParameter(0, inputs[0][CLOSE]); double[] maOutputs = new double[inputs[0][CLOSE].length]; ma.setOutputParameter(0, maOutputs); ma.calculate(0, inputs[0][CLOSE].length - 1);
// RSI calculation rsi.setOptInputParameter(0, 14); rsi.setInputParameter(0, inputs[0][CLOSE]); double[] rsiOutputs = new double[inputs[0][CLOSE].length]; rsi.setOutputParameter(0, rsiOutputs); rsi.calculate(0, inputs[0][CLOSE].length - 1);
// open, close, high, low, volume
// Print("position = " + position);
for (pos = (int) position; pos >= 0; pos--) {
srange = (0.0); j = (0); for (i = (int) 0; i < rnglength; i++) { j++; posr = (pos + i); if (posr >= getLookback()) { break; } srange = (srange + (inputs[0][HIGH][inputs[0][HIGH].length - 1 - posr] - inputs[0][LOW][inputs[0][LOW].length - 1 - posr])); } range = (srange / j * Length); BarNumber = (getLookback() - pos); if (BarNumber < 0) { BarNumber = (0); } CyclePrice = maOutputs[maOutputs.length - 1 - pos]; if (UseFilterSMAorRSI == 1) { ZL1[(pos)] = (ZeroLag(CyclePrice, FilterStrengthSMA, pos)); } if (UseFilterSMAorRSI == 2) { ZL1[(pos)] = (ZeroLag(rsiOutputs[rsiOutputs.length - 1 - pos], FilterStrengthRSI, pos)); } if (ZL1[pos] > ZL1[pos + 1]) { SwitchC = (1); } if (ZL1[pos] < ZL1[pos + 1]) { SwitchC = (2); } if (BarNumber <= 1) { if (Strength == 0) { SweepA = (range); } else { SweepA = (Strength); } Price1BuyA = (CyclePrice); Price1SellA = (CyclePrice); } if (BarNumber > 1) { if (Switch > -1) { if (CyclePrice < Price1BuyA) { if (UseCycleFilter && (SwitchC == 2) && BuySwitchA) { MinorCycleBuy[(int) (pos + BarNumber - Price1BuyB)] = (0); LineBuffer[(int) (pos + BarNumber - Price1BuyB)] = (0); } if (!UseCycleFilter && BuySwitchA) { MinorCycleBuy[(int) (pos + BarNumber - Price1BuyB)] = (0); LineBuffer[(int) (pos + BarNumber - Price1BuyB)] = (0); } Price1BuyA = (CyclePrice); Price1BuyB = (BarNumber); BuySwitchA = (true); } else if (CyclePrice > Price1BuyA) { SwitchA = (int) (BarNumber - Price1BuyB); if (!UseCycleFilter) { MinorCycleBuy[(pos + SwitchA)] = (-1); LineBuffer[(pos + SwitchA)] = (-1); } if (UseCycleFilter && SwitchC == 1) { MinorCycleBuy[(pos + SwitchA)] = (-1); LineBuffer[(pos + SwitchA)] = (-1); SwitchD = (1); } else { SwitchD = (0); } BuySwitchA = (true); cyclePrice1 = maOutputs[maOutputs.length - 1 - pos - SwitchA]; if (ActiveSwitch) { Condition1 = (CyclePrice - cyclePrice1 >= SweepA); } else { Condition1 = (CyclePrice >= cyclePrice1 * (1 + SweepA / 1000)); } if (Condition1 && SwitchA >= BuySellFac) { Switch = (-1); Price1SellA = (CyclePrice); Price1SellB = (BarNumber); SellSwitchA = (false); BuySwitchA = (false); } } } if (Switch < 1) { if (CyclePrice > Price1SellA) { if (UseCycleFilter && SwitchC == 1 && SellSwitchA) { MinorCycleSell[(int) (pos + BarNumber - Price1SellB)] = (0); LineBuffer[(int) (pos + BarNumber - Price1SellB)] = (0); } if (!UseCycleFilter && SellSwitchA) {
MinorCycleSell[(int) (pos + BarNumber - Price1SellB)] = (0); LineBuffer[(int) (pos + BarNumber - Price1SellB)] = (0); } Price1SellA = (CyclePrice); Price1SellB = (BarNumber); SellSwitchA = (true); } else if (CyclePrice < Price1SellA) { SwitchA = (int) (BarNumber - Price1SellB); if (!UseCycleFilter) { MinorCycleSell[(pos + SwitchA)] = (1); LineBuffer[(pos + SwitchA)] = (1); } if (UseCycleFilter && (SwitchC == 2)) { MinorCycleSell[(pos + SwitchA)] = (1); LineBuffer[(pos + SwitchA)] = (1); SwitchD = (2); } else { SwitchD = (0); } SellSwitchA = (true); cyclePrice2 = maOutputs[maOutputs.length - 1 - pos - SwitchA]; // (iMA(null, 0, PriceActionFilter, 0, MODE_SMMA, // PRICE_CLOSE, pos + SwitchA)); if (ActiveSwitch) { Condition1 = ((cyclePrice2 - CyclePrice) >= SweepA); } else { Condition1 = (CyclePrice <= (cyclePrice2 * (1 - SweepA / 1000))); } if (Condition1 && SwitchA >= BuySellFac) { Switch = (1); Price1BuyA = (CyclePrice); Price1BuyB = (BarNumber); SellSwitchA = (false); BuySwitchA = (false); } } } } LineBuffer[(pos)] = (0); MinorCycleBuy[(pos)] = (0); MinorCycleSell[(pos)] = (0); if (BarNumber == 1) { if (Strength == 0) { SweepB = (range * MajorCycleStrength); } else { SweepB = (Strength * MajorCycleStrength); } Price2BuyA = (CyclePrice); Price2SellA = (CyclePrice); } if (BarNumber > 1) { if (Switch2 > -1) { if (CyclePrice < Price2BuyA) { if (UseCycleFilter && SwitchC == 2 && BuySwitchB) { MajorCycleBuy[(int) (pos + BarNumber - Price2BuyB)] = (0); } if (!UseCycleFilter && BuySwitchB) { MajorCycleBuy[(int) (pos + BarNumber - Price2BuyB)] = (0); } Price2BuyA = (CyclePrice); Price2BuyB = (BarNumber); BuySwitchB = (true); } else if (CyclePrice > Price2BuyA) { SwitchB = (int) (BarNumber - Price2BuyB); if (!UseCycleFilter) { MajorCycleBuy[(pos + SwitchB)] = (-1); } if (UseCycleFilter && SwitchC == 1) { MajorCycleBuy[(pos + SwitchB)] = (-1); SwitchE = (1); } else { SwitchE = (0); } BuySwitchB = (true); cyclePrice3 = maOutputs[maOutputs.length - 1 - pos - SwitchB]; if (ActiveSwitch) { Condition6 = (CyclePrice - cyclePrice3 >= SweepB); } else { Condition6 = (CyclePrice >= cyclePrice3 * (1 + SweepB / 1000)); } if (Condition6 && SwitchB >= BuySellFac) { Switch2 = (-1); Price2SellA = (CyclePrice); Price2SellB = (BarNumber); SellSwitchB = (false); BuySwitchB = (false); } } }
if (Switch2 < 1) { if (CyclePrice > Price2SellA) { if (UseCycleFilter && SwitchC == 1 && SellSwitchB) { MajorCycleSell[(int) (pos + BarNumber - Price2SellB)] = (0); } if (!UseCycleFilter && SellSwitchB) { MajorCycleSell[(int) (pos + BarNumber - Price2SellB)] = (0); } Price2SellA = (CyclePrice); Price2SellB = (BarNumber); SellSwitchB = (true); } else if (CyclePrice < Price2SellA) { SwitchB = (int) (BarNumber - Price2SellB); if (!UseCycleFilter) { MajorCycleSell[(pos + SwitchB)] = (1); } if (UseCycleFilter && SwitchC == 2) { MajorCycleSell[(pos + SwitchB)] = (1); SwitchE = (2); } else { SwitchE = (0); } SellSwitchB = (true); cyclePrice4 = maOutputs[maOutputs.length - 1 - pos - SwitchB]; if (ActiveSwitch) { Condition6 = (cyclePrice4 - CyclePrice >= SweepB); } else { Condition6 = (CyclePrice <= cyclePrice4 * (1.0 - SweepB / 1000.0)); } if (Condition6 && SwitchB >= BuySellFac) { Switch2 = (1); Price2BuyA = (CyclePrice); Price2BuyB = (BarNumber); SellSwitchB = (false); BuySwitchB = (false); } } } } LineBuffer[(pos)] = (0); MajorCycleSell[(pos)] = (0); MajorCycleBuy[(pos)] = (0); }
// int outputSize = lookback - buffer; for (int k = outputs[0].length - 1; k >= 0; k--) { // this effectively reversed the buffers outputs[0][k] = LineBuffer[outputs[0].length - 1 - k]; outputs[1][k] = MajorCycleBuy[outputs[0].length - 1 - k]; outputs[2][k] = MajorCycleSell[outputs[0].length - 1 - k]; outputs[3][k] = MinorCycleBuy[outputs[0].length - 1 - k]; outputs[4][k] = MinorCycleSell[outputs[0].length - 1 - k]; outputs[5][k] = ZL1[outputs[0].length - 1 - k]; }
/* if (endIndex < 100) { print("calculate, startIndex=" + startIndex + " endIndex=" + endIndex + " lookback=" + getLookback() + " inputs: " + arrayToString(inputs[0]) + " outputs: " + arrayToString(outputs[0])); } else { print("calculate, startIndex=" + startIndex + " endIndex=" + endIndex + " lookback=" + getLookback() + " inputs: " + inputs[0][0].length + " outputs: " + outputs[0].length); } */ return new IndicatorResult(startIndex, outputs[0].length); }
private int toInt(boolean value) { return value ? 0 : 1; }
private void resetValues() { CyclePrice = (0.0); Strength = (0.0); SweepA = (0.0); SweepB = (0.0); Switch = (0); Switch2 = (0); SwitchA = (0); SwitchB = (0); SwitchC = (0); SwitchD = (0); SwitchE = (0); SwitchAA = (0); SwitchBB = (0); Price1BuyA = (0.0); Price2BuyA = (0.0); Price1BuyB = (1.0); Price2BuyB = (1.0); Price1SellA = (0.0); Price2SellA = (0.0); Price1SellB = (0.0); Price2SellB = (0.0); ActiveSwitch = true; BuySwitchA = false; BuySwitchB = false; SellSwitchA = false; SellSwitchB = false; BuySellFac = (1); Condition1 = true; Condition2 = true; Condition3 = true; Condition6 = true; }
public double ZeroLag(double price, int length, int pos) { double aa = 0.0; double bb = 0.0; double CB = 0.0; double CC = 0.0; double CA = 0.0; double CD = 0.0; if (length < 3) { if (true) return (price); } aa = (Math.exp(-1.414 * 3.14159 / length)); bb = (2 * aa * Math.cos(1.414 * 180 / length)); CB = (bb); CC = (-aa * aa); CA = (1 - CB - CC); CD = (CA * price + CB * ZL1[(pos + 1)] + CC * ZL1[(pos + 2)]); if (true) return (CD); return 0.0; }
public IndicatorInfo getIndicatorInfo() { return indicatorInfo; }
public InputParameterInfo getInputParameterInfo(int index) { if (index <= inputParameterInfos.length) { return inputParameterInfos[index]; } return null; }
public int getLookback() { return lookback; }
public int getLookforward() { return 0; }
public OptInputParameterInfo getOptInputParameterInfo(int index) { if (index <= optInputParameterInfos.length) { return optInputParameterInfos[index]; } return null; }
public OutputParameterInfo getOutputParameterInfo(int index) { if (index <= outputParameterInfos.length) { return outputParameterInfos[index]; } return null; }
public void setInputParameter(int index, Object array) { inputs[index] = (double[][]) array; }
public void setOptInputParameter(int index, Object value) { // timePeriod = (Integer) value; }
public void setOutputParameter(int index, Object array) { outputs[index] = (double[]) array; }
private void print(Object o) { this.console.getOut().println(o); }
private void printErr(Object o) { this.console.getErr().println(o); }
public static String arrayToString(IBar[] arr) { String str = ""; for (int r = 0; r < arr.length; r++) { str += "[" + r + "] " + arr[r] + "; "; } return str; }
public static String arrayToString(double[] arr) { String str = ""; for (int r = 0; r < arr.length; r++) { str += "[" + r + "] " + (new DecimalFormat("0.00000")).format(arr[r]) + "; "; } return str; }
public static String arrayToString(double[][] arr) { String str = ""; for (int r = 0; r < arr.length; r++) { for (int c = 0; c < arr[r].length; c++) { str += " [" + r + "][" + c + "] " + (new DecimalFormat("0.00000")).format(arr[r][c]); } str += "; "; } return str; } }
Attachments: |
CycleIdentifierJForex.java [17.25 KiB]
Downloaded 360 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Mon 14 Nov, 2011, 16:46
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
thank You for help. great work.
BUT:
I see 4 errors: 1) the indicators value is different from mql version, the JForex Api - show indicators false signals, wrong indicator work. 2)The indicator doesnt work on realtime data, it works only for previous data (historical) ? 3) The mql indicator version has different parameters compare to JForex indicator version, where I can define th max/min for indicator? 4) 4) Double Lines is not visible in indicator, only single line in JForex version ?
please see screenshot
please help me to correct work. Thank you.
Attachments: |
diff_parameters.gif [29.61 KiB]
Downloaded 393 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
API Support
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Mon 14 Nov, 2011, 17:25
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
maxi wrote: 1) the indicators value is different from mql version, the JForex Api - show indicators false signals, wrong indicator work. 2)The indicator doesnt work on realtime data, it works only for previous data (historical) ? We made the conversion purely based on the code that you provided, so it is virtually impossible to fix something without knowing a precise algorithm. Moreover, the source code itself (mq4 one from your previous posts) looks to contain some mistakes, for instance, in multiple places it references to buffer indexes like 1.6 (number should be round) and calls RSI indicator with applied price that equals MA result, which obviously does not make sense. Also when you look at the image you will see that in MT4 the indicator drew 2 red histograms in a row - presumably it supposed to draw always one green and one red. Is not it? So if the mql version contains mistakes, how are we supposed to create a working indicator without a precise algorithm? maxi wrote: 3) The mql indicator version has different parameters compare to JForex indicator version, where I can define th max/min for indicator? At the moment JForex API does not support level lines. maxi wrote: 4) Double Lines is not visible in indicator, only single line in JForex version ? They are just the same size, such that they overlap (if you changed the opacity and colors of both green bars you would see that both are there). At the moment JForex API supports only one histogram size.
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Mon 14 Nov, 2011, 17:52
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
sorry, I can't undertand.
2)The indicator doesnt work on realtime data, it works only for previous data (historical) ?
How such distinction is possible?
mq4 work in realtime - java not work realtime ??
thank You for help
please see screenshot:
Attachments: |
diff2.gif [30.84 KiB]
Downloaded 424 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Tue 15 Nov, 2011, 10:08
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
hi,
It am possible, that worked with realtime data ?
thank You
|
|
|
|
 |
API Support
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Wed 16 Nov, 2011, 08:45
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
maxi wrote: 2)The indicator doesnt work on realtime data, it works only for previous data (historical) ? It seems to be the case, but at this moment there is no way to improve on this, because of the two already mentioned reasons: 1) The mql code is flawed and your previous screenshot diff_parameters.gif shows that the indicator also in MT4 works incorrectly with live-data (2 red bars in a row). 2) The precise algorithm is unknown.
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Wed 16 Nov, 2011, 08:53
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
hello API support! You can help, You can do some to change. I have enclosed the indicator original. It has some distinctions with the former version.
original version don't have his lines in code MT:
resetValues();
and
void resetValues(){ CyclePrice = 0.0; Strength =0.0; SweepA = 0.0; SweepB = 0.0; Switch = 0; Switch2 = 0; SwitchA = 0; SwitchB = 0; SwitchC = 0; SwitchD = 0; SwitchE = 0; SwitchAA = 0; SwitchBB = 0; Price1BuyA = 0.0; Price2BuyA = 0.0; Price1BuyB = 1.0; Price2BuyB = 1.0; Price1SellA = 0.0; Price2SellA = 0.0; Price1SellB = 0.0; Price2SellB = 0.0; ActiveSwitch = True; BuySwitchA = FALSE; BuySwitchB = FALSE; SellSwitchA = FALSE; SellSwitchB = FALSE; BuySellFac = 01; Condition1 = True; Condition2 = True; Condition3 = True; Condition6 = True; }
please nake to correct in You JForex file.
Big Thanks Max
Attachments: |
Cycle_identifier.mq4 [12.22 KiB]
Downloaded 347 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
API Support
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Wed 16 Nov, 2011, 09:09
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
That line was introduced there on purpose, otherwise the indices accumulate (which should not be the case). You can check yourself that removing the code fragments that you referred to won't fix the problem.
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Wed 16 Nov, 2011, 09:15
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
You can help what to solve this problem? for correct work on realtime data.
Thank You
|
|
|
|
 |
API Support
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Wed 16 Nov, 2011, 09:19
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
maxi wrote: You can help what to solve this problem? for correct work on realtime data. By the given amount of information it is not possible, as we already answered before: API Support wrote: at this moment there is no way to improve on this, because of the two already mentioned reasons: 1) The mql code is flawed and your previous screenshot diff_parameters.gif shows that the indicator also in MT4 works incorrectly with live-data (2 red bars in a row). 2) The precise algorithm is unknown.
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Wed 16 Nov, 2011, 09:58
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
mql code file work good in MT. this original indicator. Attachments today. MT indicator. please see screenshot.
Attachments: |
c2.gif [19.17 KiB]
Downloaded 403 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Thu 17 Nov, 2011, 10:16
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
API Support wrote: at this moment there is no way to improve on this, because of the two already mentioned reasons: 1) The mql code is flawed and your previous screenshot diff_parameters.gif shows that the indicator also in MT4 works incorrectly with live-data quote] hi, You mean that the line changes? this good work for this indicator. It also should occur in jforex also. regards
|
|
|
|
 |
API Support
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Thu 17 Nov, 2011, 18:18
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
We added a recalculate all option to the indicator, meaning that it recalculate all values on every tick, in this case it works with the live-data, but such option is very unstable and inconsistent, see if you can make use of it.
Attachments: |
CycleIdentifierJForexRecalcAll.java [17.32 KiB]
Downloaded 344 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Thu 17 Nov, 2011, 18:34
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
big thanks API support, for your great work.
To cause in its strategy - is true? Object[] cycle = indicators.calculateIndicator(currentInstrument, Period.ONE_HOUR, new OfferSide[]{OfferSide.BID}, "CYCLE4", new IIndicators.AppliedPrice[]{IIndicators.AppliedPrice.TYPICAL_PRICE}, new Object[]{1, 3, 4, false, 1, 12, 21}, 0); System.out.println("cc" + cycle[0]); double CL0 = (Double) cycle[0];
Thank You Maxi
|
|
|
|
 |
maxi
|
Post subject: Re: cycle # 2 |
Post rating: 0
|
Posted: Thu 17 Nov, 2011, 19:48
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
hi, API, please see screenshot: mr.MQLConnector. last update from here: viewtopic.php?f=65&t=43327version CycleIdentifier2.mq4 + CycleFromStrat.java (not bad work in jforex, ); but: this I can't add to strategy for test. Your file CycleIdentifierJForexRecalcAll Doesn't react to change of parameters. big Thank You for help..
Attachments: |
2_ind.gif [31.83 KiB]
Downloaded 397 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
API Support
|
Post subject: Re: Cycle Identifier |
Post rating: 0
|
Posted: Tue 22 Nov, 2011, 09:02
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
We adjusted your referred strategy to work with JForex style indicator. We added an option that the indicator can calculate also on its start (not only on every bar), see parameter "Calculate results on start". Attachment:
CycleFromStratJForex.java [5 KiB]
Downloaded 367 times
|
|
|
|
 |
maxi
|
Post subject: Re: Cycle Identifier |
Post rating: 0
|
Posted: Tue 22 Nov, 2011, 09:51
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
Hello API! thank You for help!
I should use it together with CycleIdentifierJForexRecalcAll + CycleFromStratJForex ?
Thank You Max
|
|
|
|
 |
API Support
|
Post subject: Re: Cycle Identifier |
Post rating: 0
|
Posted: Tue 22 Nov, 2011, 11:57
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
It should work with both of the indicator versions (with recalculate all option and without), since their metadata (i.e. inputs, outputs, optional inputs) match. You can switch between the two by changing the first two strategy parameters
|
|
|
|
 |
API Support
|
Post subject: Re: Cycle Identifier |
Post rating: 0
|
Posted: Wed 23 Nov, 2011, 18:24
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
maxi wrote: You can show your screenshot of this indicator in jforex platform? Attachment:
CycleIdentifierBothVariants.png [55.4 KiB]
Downloaded 429 times
maxi wrote: It is necessary to insert my code of strategy in file CycleFromStratJForex? You need to locate the compiled .jfx file in strategy's parameters. Also make sure you write the correct strategy name (i.e. cycle3 for CycleIdentifierJForex.jfx and cycle4 for CycleIdentifierJForexRecalcAll.java).
|
|
|
|
 |
|
Pages: [
1, 2
»
]
|
|
|
|
|