Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

xpete

Members
  • Content Count

    1
  • Joined

  • Last visited

Personal Information

  • First Name
    peter
  • Last Name
    smith
  • Country
    United States

Trading Information

  • Vendor
    No
  1. I have an ATR code that i'd like converted to Tradestations EasyLanguage if someone has a chance? 2011-10-14_0902 - xpete911's library #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 White #property indicator_color2 Red extern int Length = 15; extern int ATRperiod = 2; extern double Kv = 4.0; extern int Shift = 1; double g_ibuf_96[]; double g_ibuf_100[]; double g_ibuf_104[]; double g_ibuf_108[]; double g_ibuf_112[]; int init() { SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2); IndicatorBuffers(5); SetIndexBuffer(0, g_ibuf_96); SetIndexBuffer(1, g_ibuf_100); SetIndexBuffer(2, g_ibuf_104); SetIndexBuffer(3, g_ibuf_108); SetIndexBuffer(4, g_ibuf_112); string ls_0 = "ATRStops(" + Length + ")"; IndicatorShortName(ls_0); SetIndexLabel(0, "Up"); SetIndexLabel(1, "Dn"); SetIndexDrawBegin(0, Length); SetIndexDrawBegin(1, Length); return (0); } int start() { int li_4; int l_ind_counted_8 = IndicatorCounted(); if (l_ind_counted_8 > 0) li_4 = Bars - l_ind_counted_8; if (l_ind_counted_8 < 0) return (0); if (l_ind_counted_8 == 0) li_4 = Bars - Length - 1; for (int li_0 = li_4; li_0 >= 0; li_0--) { g_ibuf_104[li_0] = High[iHighest(NULL, 0, MODE_HIGH, Length, li_0 + Shift)] - Kv * iATR(NULL, 0, ATRperiod, li_0 + Shift); g_ibuf_108[li_0] = Low[iLowest(NULL, 0, MODE_LOW, Length, li_0 + Shift)] + Kv * iATR(NULL, 0, ATRperiod, li_0 + Shift); g_ibuf_112[li_0] = g_ibuf_112[li_0 + 1]; if (Close[li_0] > g_ibuf_108[li_0 + 1]) g_ibuf_112[li_0] = 1; if (Close[li_0] < g_ibuf_104[li_0 + 1]) g_ibuf_112[li_0] = -1; if (g_ibuf_112[li_0] > 0.0) { if (g_ibuf_104[li_0] < g_ibuf_104[li_0 + 1]) g_ibuf_104[li_0] = g_ibuf_104[li_0 + 1]; g_ibuf_96[li_0] = g_ibuf_104[li_0]; g_ibuf_100[li_0] = EMPTY_VALUE; } if (g_ibuf_112[li_0] < 0.0) { if (g_ibuf_108[li_0] > g_ibuf_108[li_0 + 1]) g_ibuf_108[li_0] = g_ibuf_108[li_0 + 1]; g_ibuf_96[li_0] = EMPTY_VALUE; g_ibuf_100[li_0] = g_ibuf_108[li_0]; } } return (0); }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.