Need Help in divergenct price object creation

Aung Swar
189
Aung Swar  

Hello All coders.Nice to meet you.

I have some difficulty in create Divergence object in chart.

My idea is to create divergence line by two conditions


1 -if  Highest Bar in last 100 Bars < High Bar in last 5 bars ,Draw trendline in chart by two anchor points (last highest bar and last 5 high bar)

2 -if  Highest RSI value in last 100 bar > Rsi value last 5 bars ,Draw trendline in chart.



 just want to estimate possible divergence not exactly but generally.

My main purpose is

To detect reduce trend momentum .

If trend momentum reduce .I decide for orders in EA.


Here my codes are

     for (int i=Bars;i>=100;i--)  
 
  
        {
      
  
        int highestlast100bars= High[iHighest(NULL, 0, MODE_HIGH,i,1)];    
        double lastRSIHigh= iRSI(NULL,0,14,PRICE_CLOSE,i);    
        double currentRSI = iRSI(NULL,0,14,PRICE_CLOSE,1);

     if ( lastRSIHigh > currentRSI )
   {
    ObjectCreate (0,"DivergenceTRend",OBJ_TREND,0,Time[highestlast100bars],High[highestlast100bars],Time[3],High[3]);
    
    ObjectSetInteger (0,"DivergenceTRend",OBJPROP_COLOR,Red);
    ObjectSetInteger (0,"DivergenceTRend",OBJPROP_STYLE,STYLE_SOLID);
    ObjectSetInteger (0,"DivergenceTRend",OBJPROP_WIDTH,1);
    
    ObjectDelete("DivergenceTRend");
   } 
    
     
     }
     
     

Please suggest  some modification or show me if you have better tools to check decrease trend momentum condition after strong trend.

Thanks.


Aung Swar
189
Aung Swar  
LOL. What kind of forum. 
Forum mean to exchange knowledge between users. 
Most in here are looking for pay and not helpful. 
Keith Watford
Moderator
27973
Keith Watford  

Opening a new topic, then waiting not even 90 minutes and then posting

Aung Swar:
LOL. What kind of forum. 
Forum mean to exchange knowledge between users. 
Most in here are looking for pay and not helpful. 

is a sure way to make sure that nobody will want to help you!

William Roeder
24207
William Roeder  
Aung Swar: Most in here are looking for pay and not helpful. 

Actually, it's the opposite. Most here are looking for slaves to code for free and not willing to put in the effort to learn or pay someone.

You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help 2017.04.21