Jump to content
Medved Trader Forums

Salvatore

Recommended Posts

hello, i need help with this from QT to Medved.

i am doing everything manually since there is no import for the paintbars, I have this on the QT paintbar and i need converted to Medved.

Two rules:

if (ABS((Bar Open - Bar Close) /  (Bar High - Bar Low)) <= 0.35) and (Bar Low < EMA(30)) set color to White

if (ABS((Bar Open - Bar Close) /  (Bar High - Bar Low)) <= 0.2) and (Bar Low < EMA(30)) set color to White

I have this for Medved:

Ema_Line parameter 30



Any help with this will be appreciated.

Thanks

Sal

Link to comment
Share on other sites

Assuming you have that EMA_Line defined, here is what the code (in Advanced Mode) would look like:

public void MainCalculation()
{
    if ((Math.Abs(Open - Close) / (High - Low)) <= 0.2D && Low < EMA_Line)
    {
        SetColor("Main", Color.White);
    }
    else if ((Math.Abs(Open - Close) / (High - Low)) <= 0.35D && Low < EMA_Line)
    {
        SetColor("Main", Color.White);
    }
}

NOTE: you are setting it to White in both situations - I assume you want to set it to different colors. You can change them as needed. Also, right now in the example I defined one named color ("Main"), so when you add the paintbar to the chart and look at the parameters, there will be a color box defaulted to White, but which you can change. That way you do not have to hardcode the color in the Paintbar definition. If you use 2 different names in the 2 IF statements above, then there will be 2 defined colors and you would be able to set them in the chart indicator parameters independently.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...