// More information about this indicator can be found at: // http://fxcodebase.com/code/viewtopic.php?f=28&t=61988 //+------------------------------------------------------------------+ //| Copyright © 2018, Gehtsoft USA LLC | //| http://fxcodebase.com | //+------------------------------------------------------------------+ //| Developed by : Mario Jemic | //| mario.jemic@gmail.com | //+------------------------------------------------------------------+ //| Support our efforts by donating | //| Paypal : https://goo.gl/9Rj74e | //+------------------------------------------------------------------+ //| Patreon : https://goo.gl/GdXWeN | //| BitCoin : 15VCJTLaz12Amr7adHSBtL9v8XomURo9RF | //| BitCoin Cash : 1BEtS465S3Su438Kc58h2sqvVvHK9Mijtg | //| Ethereum : 0x8C110cD61538fb6d7A2B47858F0c0AaBd663068D | //| LiteCoin : LLU8PSY2vsq7B9kRELLZQcKf5nJQrdeqwD | //+------------------------------------------------------------------+ // Trading arrows template v.1.0.0 //1. string IndicatorName = "[Place your indicator name here]"; //2. Implement int GetDirection( //3. place your parameters here #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Green #property indicator_color2 Red #property indicator_color3 Red #property indicator_color4 Green #property indicator_label1 "BUY" #property indicator_label2 "SELL" #property indicator_label3 "EXIT BUY" #property indicator_label4 "EXIT SELL" double buy[], sell[], exit_buy[], exit_sell[]; int init() { IndicatorShortName(IndicatorName); IndicatorDigits(Digits); SetIndexStyle(0, DRAW_ARROW, 0, 2); SetIndexArrow(0, 217); SetIndexBuffer(0, buy); SetIndexStyle(1, DRAW_ARROW, 0, 2); SetIndexArrow(1, 218); SetIndexBuffer(1, sell); SetIndexStyle(2, DRAW_ARROW, 0, 2); SetIndexArrow(2, 217); SetIndexBuffer(2, exit_buy); SetIndexStyle(3, DRAW_ARROW, 0, 2); SetIndexArrow(3, 218); SetIndexBuffer(3, exit_sell); return(0); } int deinit() { return(0); } #define ENTER_BUY_SIGNAL 1 #define ENTER_SELL_SIGNAL -1 #define EXIT_BUY_SIGNAL 2 #define EXIT_SELL_SIGNAL -2 int GetDirection(const int period) { // insert your code here. // return ENTER_BUY_SIGNAL for the up trend/buy // return ENTER_SELL_SIGNAL for the down trend/sell // return EXIT_BUY_SIGNAL for the up trend end/exit buy // return EXIT_SELL_SIGNAL for the down trend end/exit sell // return 0 for the neutral/no action return 0; } string GetTimeframe() { switch (_Period) { case PERIOD_M1: return "M1"; case PERIOD_M5: return "M5"; case PERIOD_D1: return "D1"; case PERIOD_H1: return "H1"; case PERIOD_H4: return "H4"; case PERIOD_M15: return "M15"; case PERIOD_M30: return "M30"; case PERIOD_MN1: return "MN1"; case PERIOD_W1: return "W1"; } return "M1"; } int start() { if (Bars <= 1) return(0); int ExtCountedBars = IndicatorCounted(); if (ExtCountedBars < 0) return(-1); int limit = Bars - 1; if(ExtCountedBars > 1) limit = Bars - ExtCountedBars - 1; int pos = limit; while (pos >= 0) { int direction = GetDirection(pos); switch (direction) { case ENTER_BUY_SIGNAL: buy[pos] = Low[pos]; sell[pos] = EMPTY_VALUE; exit_sell[pos] = EMPTY_VALUE; exit_buy[pos] = EMPTY_VALUE; break; case ENTER_SELL_SIGNAL: buy[pos] = EMPTY_VALUE; sell[pos] = High[pos]; exit_sell[pos] = EMPTY_VALUE; exit_buy[pos] = EMPTY_VALUE; break; case EXIT_BUY_SIGNAL: buy[pos] = EMPTY_VALUE; sell[pos] = EMPTY_VALUE; exit_sell[pos] = EMPTY_VALUE; exit_buy[pos] = Low[pos]; break; case EXIT_SELL_SIGNAL: buy[pos] = EMPTY_VALUE; sell[pos] = EMPTY_VALUE; exit_sell[pos] = High[pos]; exit_buy[pos] = EMPTY_VALUE; break; } pos--; } return(0); }