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.

get value of cross
 Post subject: get value of cross Post rating: 0   New post Posted: Fri 30 Nov, 2012, 08:14 

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

i want to get a precise value of the ema cross.see the attached file.

how to get it and how to keep in memory?

thanks you for your help.

eric


Attachments:
crosspoint.png [24.25 KiB]
Downloaded 348 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.
 
 Post subject: Re: get value of cross Post rating: 0   New post Posted: Fri 30 Nov, 2012, 11:25 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/#Line_intersection


 
 Post subject: Re: get value of cross Post rating: 0   New post Posted: Sun 02 Dec, 2012, 16:44 

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

thank for your reply.

i did succesfully for ema crossing.

this is my code
for(int i=0; i< emaopen.length - 1; i++){
            PointDbl emapoint = intersection(
                    bars[i].getTime(), emaopen[i], bars[i+1].getTime(), emaopen[i+1],
                    bars[i].getTime(), emaclose[i], bars[i+1].getTime(), emaclose[i+1]
                    );
             
             if(emapoint != null
             && emaclose[curr] >= emaclose[prev]
         && emaopen[curr] <= emaopen[prev]
         && emaclose[curr] >= emaopen[curr]){
         
         emacrossup = emapoint.y;
         }
         
         if(emapoint != null
         && emaclose[curr] <= emaclose[prev]
         && emaopen[curr] >= emaopen[prev]
         && emaclose[curr] <= emaopen[curr]){
                    
         emacrossdown = emapoint.y;
         }
      }


but now i would like to find the previous cross. i tried to follow this example : viewtopic.php?f=65&t=47360, but without a succes.

could you help me please?

thank
eric


 
 Post subject: Re: get value of cross Post rating: 0   New post Posted: Mon 03 Dec, 2012, 10:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The cross occurrence is undeterministic, so you just need to determine yourself what is the candle interval over which you want to check the crosses. You can increase it by increasing the value of fromShift in the Indicator output line intersection example.


 
 Post subject: Re: get value of cross Post rating: 0   New post Posted: Mon 03 Dec, 2012, 12:36 

User rating: 1
Joined: Wed 07 Mar, 2012, 05:56
Posts: 101
Location: New CaledoniaNew Caledonia
sorry but it's impossible for me to do what you say if i understand correctly your answer.
i mean i would like to find the previous cross to compare with the current cross for find a divergence on cross. so the cross appear on different number of candle. sometime at 10 candles before the current cross sometime at 5 and so one.

is it possible to create a table with the crossing variable with a determinate length?
for example if the length of table is 2 when the cross occur the value of cross go to the table at the first place. when the new cross occur the first cross go to the second place in the table and the new cross at the first place.when the third cross occur, the first cross go out of the table, the second go to second place and the third go to the first place.
so when i want to compare the previous cross and the current cross i do this :

double[] crossingtable = new crossingtable(emacrossup,2,bar.getTime(),0);//the syntax isn't good it's just an idea
if (crossingtable[0] > crossingtable[1]){
buySign = true;
}

sorry it's difficult for me to explain in english. i hope is clear.
eric


 
 Post subject: Re: get value of cross Post rating: 0   New post Posted: Mon 03 Dec, 2012, 13:30 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Just use the second example from the wiki article, change sma to ema, increase fromShift to say 200 and fetch the values in a java.util.List where there currently a signal error gets drawn.


 

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