Announcement

Collapse
No announcement yet.

Print Text or Character on Chart

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

  • Print Text or Character on Chart

    Hello,

    How do you print Text on a chart or a character below the low of the bar via EFS?


  • #2

    Hello sunman4008,
    Below you'll find some examples of how to put text on a chart. Also I'm going to attach a word document that has the text and location flags for putting text on a chart. It also has directions on how to find the character map on a windows computer where you can check out the various wingding fonts so that you can explore some of the symbols that you can put on a chart. For more information on various EFS functions, go to the EFS Glossary in eSignal's EFS KnowledgeBase.

    var nCountLows = 0;
    drawTextRelative(-10, low(-10) - 0.5, low(-10), Color.teal, null, Text.TOP | Text.CENTER, "Courier", 10, "CountLows" + ++nCountLows);
    Instead of a yValue of low(-10) - 0.5 as in above, you can use BelowBar1 (or 2, 3, 4 each representing a lower row below the bar).

    drawTextRelative(0, BottomRow1, "\u00EA", Color.red, null, Text.PRESET|Text.CENTER, "Wingdings", 10, "Sell"+rawtime(0)); // This puts a red down arrow on the bottom of the chart at xBar zero.
    drawTextRelative(0, BottomRow2, "\u00E9", Color.green, null, Text.PRESET|Text.CENTER, "Wingdings", 10, "Buy"+rawtime(0)); // This puts a green up arrow one row up from the bottom of the chart.
    You can also use TopRow1...there are 4 BottomRows and 4 TopRows.

    Instead of something like "CountLows" + ++nCountLows for the TagName, if you have no need to track how many places you're putting text, you can just use rawtime(0) instead. Both of these will create text that will "stick" to the chart at that location as new bars stream in. In steaming mode, the above example would put the low of bar -10 on the chart as each new bar streamed in, so you would need code to make it useful, otherwise it will be a mess. Another thing you could do is to just use "CountLows" by itself, in which case the prior text would disappear as new bars steam in and bar -10 would always have the low price printed under it.

    Below is an example of putting text that updates with new values on the top right of the chart, where they are fixed and don't move as new bars stream in. Since the TagName on the end of each statements isn't unique, the prior number disappears and is replaced with the new number as it updates.

    var nTodayPL = 0; // Todays Total PL
    var nRTHPL = 0; // Regular Trading Hours PL
    var nAHPL = 0; // After Hours PL

    drawTextAbsolute(0, TopRow1, nTodayPL.toFixed(2), Color.green, null, Text.PRESET|Text.CENTER, "Arial", 12, "MyTodayPL");
    drawTextAbsolute(-15, TopRow1, nRTHPL.toFixed(2), Color.green, null, Text.PRESET|Text.CENTER, "Arial", 12, "MyRTHPL");
    drawTextAbsolute(-30, TopRow1, nAHPL.toFixed(2), Color.green, null, Text.PRESET|Text.CENTER, "Arial", 12, "MyAHPL");

    I hope that this all helps...happy coding!!
    Attached Files

    Comment


    • #3
      One key point that I forgot to mention, and I see it as a mistake in my first reply, is that if you're going to use the text location flags (BelowBar1..., BottomRow3..., etc.), then you MUST use Text.PRESET or else nothing will show up on the chart.
      drawTextRelative(-1, BelowBar2, "Anything", Color.yellow, null, Text.PRESET|Text.CENTER, "Courier", 10, rawtime(0));
      If instead of Text.PRESET, you used Text.TOP with a location flag as your yValue, then nothing would show up on the chart. If you think about it, the location flags are "PRESET"TING the yValue location, which is why you used the location flag as the yValue location...sorry for any confusion.

      Comment

      Working...
      X