Announcement

Collapse
No announcement yet.

Is it possible to display entry/exit prices

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

  • Is it possible to display entry/exit prices

    With your help, I was able to create the arrows to display on a chart when a buy/sell signal is generated. Is it also possible to display the entry/exit price next to the arrow?

    Thanks,
    Derek

  • #2
    Derek
    You can do that using the drawTextRelative() command (syntax follows)
    drawTextRelative(xBar, yValue, Text, [FGColor], [BGColor], [Flags], [FontName], [FontSize], [TagName], [cx], [cy])
    If you can provide more details then a more specific command could be suggested
    Alex

    Comment


    • #3
      Hi Alex, quick response!

      I used the EFS function wizard, so each generated signal (buy, sell, short, cover) is a separate action and is "next bar at market." Here's the action for a buy signal.

      function onAction1() {
      if (vLastAlert != 1) Strategy.doLong("Initial Long", Strategy.MARKET, Strategy.NEXTBAR, Strategy.DEFAULT, 0);
      if (vLastAlert != 1) drawTextRelative(0, low(), "B", Color.RGB(155,0,0), Color.RGB(255,255,255), Text.BOLD, "Arial", 18);
      if (vLastAlert != 1) ScaleLevel = 1;
      if (vLastAlert != 1) nEntryPrice = close();
      vLastAlert = 1;

      Comment


      • #4
        Derek
        This is somewhat tricky if you are running the efs in real time because the Open of the next bar (ie the Entry Price) is an unknown value.
        What you could do is create another set where the condition is if(Strategy.isLong()==true) then in the while the following will happen only the first time you use drawTextRelative and record the Open of that bar.
        Then you would repeat the same for Strategy.isShort().
        Alex

        Comment

        Working...
        X