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.

Renko - how to access opposite wick data using JForex API
 Post subject: Renko - how to access opposite wick data using JForex API Post rating: 0   New post Posted: Thu 02 Nov, 2017, 23:08 
User avatar

User rating: 8
Joined: Mon 09 Jun, 2014, 21:07
Posts: 49
Location: Poland, Warsaw
Hi Dukascopy Team,

The JForex charts allow to represent renko with 2 wicks. IRenkoBar has a method to get value of one the wicks only, how to get the opposite wick?

IRenkoBar instance is actually a RenkoData class instance which holds required information and has relvant method to get the opposite wick. However, the RenkoData class is not part of public JForex API, hence it cannot be used in the JForex strategy.

Can you please support how to get the info?

Thanks & best regards,
Greg


 
 Post subject: Re: Renko - how to access opposite wick data using JForex API Post rating: 0   New post Posted: Sat 04 Nov, 2017, 22:14 
User avatar

User rating: 8
Joined: Mon 09 Jun, 2014, 21:07
Posts: 49
Location: Poland, Warsaw
Hi again Dukascopy Team,

I managed to access information about opposite wick using reflection. This dirty hack though and it does not work in remote mode as it requires @RequiresFullAccess annotation, which use is not allowed in remote mode.

Is there better solution to access opposite wick?

import java.lang.reflect.Field;

import com.dukascopy.api.JFException;
import com.dukascopy.api.feed.IRenkoBar;

public class Wicks {

   private Double wick, oppositeWick;

   public Wicks(IRenkoBar renkoBar, boolean isFullAccessGranted) throws JFException {

      try {
         if (isFullAccessGranted) {
            Field[] fs = renkoBar.getClass().getDeclaredFields();
            int counter = 0;

            for (Field f : fs) {
               f.setAccessible(true);

               if (counter == 1) {
                  wick = (Double) f.get(renkoBar);
               }
               if (counter == 2) {
                  oppositeWick = (Double) f.get(renkoBar);
               }

               counter++;

            }
         } else {
            wick = renkoBar.getWickPrice();
         }
      } catch (Exception e) {
         throw new JFException(e);
      }
   }

   public Double getWick() {
      return wick;
   }

   public Double getOppositeWick() {
      return oppositeWick;
   }
}


Best regards,
Greg


 

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