Announcement

Collapse
No announcement yet.

Help with adding an offset to MAPriceBars.efs

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

  • Help with adding an offset to MAPriceBars.efs

    Under Formulas...PriceBars...there is an .efs called MA Price Bars .efs I wanted to enter an additional code entry that would enable me to use an "offset" for the moving average. Eg...as in the basic moving average you can offset it by the number of bar you want. Any assistance on what code line to add and where to add it would be greatly appreciated. I know I will have to save it as a newly named .efs, but then I will have one with an offset.
    Thank you very much

  • #2
    lorend
    To add an offset you would actually need to modify two EFSs ie the one you reference and ma.efs that is in the Library folder. You may find it easier to modify instead the builtinMA.efs that is in the Builtin folder and that is fully customizable (ie you can change source, type of average, offset, etc). To modify builtinMA.efs open the efs with the Editor and in preMain add the following two lines after the line setDefaultBarThickness(1,0);

    PHP Code:
    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.black); 
    Then in main after the comment section "Insert your code following...etc" add the following lines

    PHP Code:
    if(vMA.getValue(MAStudy.MA)>=close(0)){
            
    setPriceBarColor(Color.red);
        }else if(
    vMA.getValue(MAStudy.MA)<close(0)){
            
    setPriceBarColor(Color.lime);
        } 
    Save the efs with a different name
    Alex

    Comment

    Working...
    X