Announcement

Collapse
No announcement yet.

Changing 2 MA study to 2 CCI study

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ACM
    replied
    Re: I'm stuck

    Dave
    Actually it is working correctly. You need to keep in mind that eSignal paints the background of the space between the center [which is the data point] of a bar and the center of the following bar
    What you can do is replace the setBarBgColor() command which paints the background of the current bar with the setBar() command which allows you to modify the properties of any preceeding bar and paint instead the prior bar's background. For the description and syntax of this function [in case you want to use it in other situations] see the link to the related article in the EFS KnowledgeBase



    Also try searching the forums where you will find many examples as these topics have been discussed extensively before
    At this point I believe you should have sufficient information available to allow you to tweak the script to your requirements.
    Alex


    Originally posted by ddawson7
    Alex:

    I'm having trouble with the values vs the colors, I'm stuck.
    I got where ther should be greens and the trend lines are not correct.
    Please take a look....thanks

    Leave a comment:


  • ddawson7
    replied
    I'm stuck

    Alex:

    I'm having trouble with the values vs the colors, I'm stuck.
    I got where ther should be greens and the trend lines are not correct.
    Please take a look....thanks
    Attached Files

    Leave a comment:


  • ACM
    replied
    Re: CCI Color bars

    Dave
    Again you would just need to modify the conditional statement to reflect those conditions.
    To determine if the CCI study is in a trend you compare its current value ie CCIx.getValue(CCIStudy) to that of the prior bar ie CCIx.getValue(CCIStudy.CCI, -1) where the -1 indicates the prior bar [as you can also see in the other conditions and explanations I posted earlier] and you repeat that check for both CCIs and add it to the current conditional statement. You can see an example of how you would do it in the screenshot enclosed below. Then repeat the logic [obviously with the opposite operator] for the other conditional statement.
    FWIW in the formula you last posted the second conditional statement does not replicate the first one so you will need to update it
    Alex




    Originally posted by ddawson7
    Alex:

    Thanks for your excellent help.
    Colors bars working as I asked, would now like to tweak.
    Right now, when the CCI lines cross, the bars turn green or red which ever line is on top as I asked. I would like the color bars to go blank if a downward trend occurs when the blue line is on top. So another words, if the blue line crosses the red and both lines are rising, the bar turns green and stays green untill either the lines begin downward in which case bars have no color, or red bars occur when the blue line decends below the red line only in a downward movement.

    Thanks again.....

    Current study attached

    Dave D

    Leave a comment:


  • ddawson7
    replied
    CCI Color bars

    Alex:

    Thanks for your excellent help.
    Colors bars working as I asked, would now like to tweak.
    Right now, when the CCI lines cross, the bars turn green or red which ever line is on top as I asked. I would like the color bars to go blank if a downward trend occurs when the blue line is on top. So another words, if the blue line crosses the red and both lines are rising, the bar turns green and stays green untill either the lines begin downward in which case bars have no color, or red bars occur when the blue line decends below the red line only in a downward movement.

    Thanks again.....

    Current study attached

    Dave D
    Attached Files

    Leave a comment:


  • ACM
    replied
    Re: Only 1 bar is colored

    Dave

    what is the text for HLC/3 is lieu of "close"
    "HLC/3"

    I am only getting one color bar upon crossing.
    Is this because of the only alert once script, if so, what do I remove. study attached
    No that is because of how the condition to color the bars is set up ie to identify the bar of the crossover.
    If you want to paint the background of all the bars that follow you need to make that condition not unique eg

    PHP Code:
    if(vCCI1.getValue(CCIStudy.CCI,-1) > vCCI2.getValue(CCIStudy.CCI,-1) &&
        
    vCCI1.getValue(CCIStudy.CCI) < vCCI2.getValue(CCIStudy.CCI)){ 
    which essentially says
    if CCI1 of the prior bar was above CCI2 of the prior bar and CCI1 of the current bar is below CCI2 of the current bar then..
    needs to be replaced with the following
    PHP Code:
    if(vCCI1.getValue(CCIStudy.CCI) < vCCI2.getValue(CCIStudy.CCI)){
            
    setBarBgColor(Color.green); 
    which now says
    if CCI1 of the current bar is below CCI2 of the current bar then...
    Apply the same modification also to the other condition
    Alex


    Originally posted by ddawson7
    Alex

    Thank you for the color bar script, its getting closer....
    2 things, what is the text for HLC/3 is lieu of "close"
    2nd, I am only getting one color bar upon crossing.
    Is this because of the only alert once script, if so, what do I remove. study attached
    thanks

    Dave D

    Leave a comment:


  • ddawson7
    replied
    Only 1 bar is colored

    Alex

    Thank you for the color bar script, its getting closer....
    2 things, what is the text for HLC/3 is lieu of "close"
    2nd, I am only getting one color bar upon crossing.
    Is this because of the only alert once script, if so, what do I remove. study attached
    thanks

    Dave D
    Attached Files

    Leave a comment:


  • ACM
    replied
    Re: Sent the wrong study

    Dave
    Assuming you made all the changes I suggested to the first script you posted (including renaming of all the variables) then you would just need to add the following lines of code inserting them just above the return statement
    PHP Code:
    if(vCCI1.getValue(CCIStudy.CCI,-1) > vCCI2.getValue(CCIStudy.CCI,-1) &&
        
    vCCI1.getValue(CCIStudy.CCI) < vCCI2.getValue(CCIStudy.CCI)){
            
    setBarBgColor(Color.red);
    }
    else if (
    vCCI1.getValue(CCIStudy.CCI,-1) < vCCI2.getValue(CCIStudy.CCI,-1) &&
        
    vCCI1.getValue(CCIStudy.CCI) > vCCI2.getValue(CCIStudy.CCI)){
            
    setBarBgColor(Color.green);

    This will color the background of the bar at the crossovers
    Alex


    Originally posted by ddawson7
    Alex:

    The first time I sent the 2 MA's for sound, I meant to send the color bar Study which is attached correctly this time.

    How would I get the colors to change from red to green using 2 CCI's instead of 2 MA's

    Thanks again

    Leave a comment:


  • ddawson7
    replied
    Sent the wrong study

    Alex:

    The first time I sent the 2 MA's for sound, I meant to send the color bar Study which is attached correctly this time.

    How would I get the colors to change from red to green using 2 CCI's instead of 2 MA's

    Thanks again
    Attached Files

    Leave a comment:


  • ACM
    replied
    Dave
    You are most welcome
    Alex


    Originally posted by ddawson7
    Thanks for the quick response Alex, I'll give it a try


    Dave D

    Leave a comment:


  • ddawson7
    replied
    Thanks for the quick response Alex, I'll give it a try


    Dave D

    Leave a comment:


  • ACM
    replied
    Re: Changing 2 MA study to 2 CCI study

    Dave
    The simplest solution is the following. Replace these two lines of code
    PHP Code:
    vMA1 = new MAStudy(MALength10"Close" MAStudy.SIMPLE);
    vMA2 = new MAStudy(MALength20"Close" MAStudy.SIMPLE); 
    with the following
    PHP Code:
    vMA1 = new CCIStudy(MALength1"Close");
    vMA2 = new CCIStudy(MALength2"Close"); 
    Then replace each instance of MAStudy.MA with CCIStudy.CCI eg vMA1.getValue(MAStudy.MA) becomes vMA1.getValue(CCIStudy.CCI). You can do this in one step by using the Replace tool in the EFS Editor
    At this point the formula will work. If you then want you can also rename all the variables replacing each instance of MA with CCI For example vMA1 becomes vCCI1, MALength1 becomes CCILength1, vMA1.getValue(CCIStudy.CCI) becomes vCCI1.getValue(CCIStudy.CCI), etc
    Lastly in preMain remove the setPriceStudy(true) statement [or set it to false]
    Alex


    Originally posted by ddawson7
    Attached is a two moving average study with color bars and an audio alert. I like it and it works well.
    I would like the same study using 2 CCI's say like a 6 CCI and a 14CCI changing colors and playing a .wav when the 2 lines cross.
    How can I do this.

    Dave D

    Leave a comment:


  • ddawson7
    started a topic Changing 2 MA study to 2 CCI study

    Changing 2 MA study to 2 CCI study

    Attached is a two moving average study with color bars and an audio alert. I like it and it works well.
    I would like the same study using 2 CCI's say like a 6 CCI and a 14CCI changing colors and playing a .wav when the 2 lines cross.
    How can I do this.

    Dave D
    Attached Files
Working...
X