Dukascopy
 
 
Wiki JStore Search Login

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.

historical high values
 Post subject: historical high values Post rating: 0   New post Posted: Thu 29 Mar, 2012, 13:58 

User rating: 1
Joined: Wed 07 Mar, 2012, 05:56
Posts: 101
Location: New CaledoniaNew Caledonia
hello support,

i try to use this wiki :https://www.dukascopy.com/wiki/#Historical_high_values

well it's perfect for my short signal but the strategy don't take a long signal

maybe i do something wrong. i have printed messages with console.getOut and all seem good.

that's my code for values

long lastTickTime = history.getLastTick(instrument).getTime();
        long lastBarTime = history.getBarStart(period, lastTickTime);
       
        List<IBar> bars = history.getBars(instrument, period, OfferSide.ASK, Filter.NO_FILTER, 10, lastBarTime, 0);
      List<IBar> bars20 = history.getBars(instrument, period, OfferSide.ASK, Filter.NO_FILTER, 20, lastBarTime, 0);
       
        double maxHigh10 = 0;
      double maxHigh20 = 0;
        double minLow10 = 0;
        double minLow20 = 0;
       
      for(IBar bar : bars){
            if(maxHigh10 < bar.getHigh()){
                maxHigh10 = bar.getHigh();
            }
         if(minLow10 < bar.getLow()){
                minLow10 = bar.getLow();
            }
          }

           
      for(IBar bar : bars20){
            if(maxHigh20 < bar.getHigh()){
                maxHigh20 = bar.getHigh();
            }
         if(minLow20 < bar.getLow()){
                minLow20 = bar.getLow();
            }
          }


that's my code for signal
if (prevBar1.getOpen() < prevBar1.getClose()
         && prevBar.getClose() > prevBar1.getOpen()
            && currBar.getClose() < prevBar1.getLow()
            && ma1 > ma11
            && maxHigh20 > maxHigh10){
           
            sellSign = true;
            sellPrice = currBar.getLow() - getPipPrice(pipsBelow);   
            }
                   
       //for buy
         if(prevBar1.getOpen() > prevBar1.getClose()
            && prevBar.getClose() < prevBar1.getOpen()
            && currBar.getClose() > prevBar1.getHigh()
            /*&& ma1 < ma11*/
            && minLow20 < minLow10){
           
            buySign = true;
            buyPrice = currBar.getHigh() + getPipPrice(pipsAbove);
            }


so, when i backtest this strategy a error messages appear :

12:53:29 Strategy tester: com.dukascopy.api.JFException: Could not load bar for instrument [EUR/USD], period [15 Mins], side [Ask], start time [2011.04.04 09:00:00 000], current bar start time [2011.04.04 09:15:00 000] @ jforex.strategies.indicators.reversalbar1.onBar(reversalbar1.java:98).

i'm looking for a while the solution but i can't find anything.

could you help me please.

best regards


 
 Post subject: Re: historical high values Post rating: 0   New post Posted: Fri 30 Mar, 2012, 06:25 

User rating: 1
Joined: Wed 07 Mar, 2012, 05:56
Posts: 101
Location: New CaledoniaNew Caledonia
hello support,

i'm so stupid. i found the problem

before :

if(prevBar1.getOpen() > prevBar1.getClose()
&& prevBar.getClose() < prevBar1.getOpen()
&& currBar.getClose() > prevBar1.getHigh()
/*&& ma1 < ma11*/
&& minLow20 <minLow10

after

if(prevBar1.getOpen() > prevBar1.getClose()
&& prevBar.getClose() < prevBar1.getOpen()
&& currBar.getClose() > prevBar1.getHigh()
/*&& ma1 < ma11*/
&& minLow20 > minLow10


no comment... :oops:
i'm really sorry for that.

but i always have this error message :

12:53:29 Strategy tester: com.dukascopy.api.JFException: Could not load bar for instrument [EUR/USD], period [15 Mins], side [Ask], start time [2011.04.04 09:00:00 000], current bar start time [2011.04.04 09:15:00 000] @ jforex.strategies.indicators.reversalbar1.onBar(reversalbar1.java:98).

and i don't no why.


 
 Post subject: Re: historical high values Post rating: 0   New post Posted: Fri 30 Mar, 2012, 08:47 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
ericbiz wrote:
12:53:29 Strategy tester: com.dukascopy.api.JFException: Could not load bar for instrument [EUR/USD], period [15 Mins], side [Ask], start time [2011.04.04 09:00:00 000], current bar start time [2011.04.04 09:15:00 000] @ jforex.strategies.indicators.reversalbar1.onBar(reversalbar1.java:98).
There might be some problem with historical data in your local cache, consider cleaning it - it should reload from the server on the next call.


 
 Post subject: Re: historical high values Post rating: 0   New post Posted: Fri 30 Mar, 2012, 08:52 

User rating: 1
Joined: Wed 07 Mar, 2012, 05:56
Posts: 101
Location: New CaledoniaNew Caledonia
ok thanks you it try to test it


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com