string name = "test1\\Schaff Trend Cycle.ex5";
Where exactly did you put it? You indicate you put it at «DataFolder»\MQL5\Indicators\test1
William Roeder #:
Where exactly did you put it? You indicate you put it at «DataFolder»\MQL5\Indicators\test1
yes i did put it there \MQL5\Indicators\test1\Schaff Trend Cycle.ex5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
#include <Trade/Trade.mqh> int handle; datetime lastSignal; CTrade trade; int OnInit() { string name = "test1\\Schaff Trend Cycle.ex5"; handle = iCustom(_Symbol, PERIOD_CURRENT, name ); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { int indexCurrent = -1, indexLast = -1; for(int i = 0; i < 10000; i++){ double indiRed[]; CopyBuffer(handle,1,i,1,indiRed); double indiGreen[]; CopyBuffer(handle,2,i,1,indiGreen); if(indiGreen[0] > 0 || indiRed[0] > 0){ if(indexCurrent < 0){ indexCurrent = i; }else{ indexLast = i; datetime time = iTime(_Symbol,PERIOD_CURRENT,i); if(time > lastSignal){ if(indiGreen[0] > 0 ){ Print(__FUNCTION__ ," > New buy signal at ", time); trade.PositionClose(_Symbol); trade.Buy(1); }else if(indiRed[0] > 0){ Print(__FUNCTION__," > New sell signal at ", time); trade.PositionClose(_Symbol); trade.Sell(1); } } lastSignal = time; break; } } Comment("\nIndex Curent", indexCurrent, "\nIndex Last: ",indexLast, "\n Last Signal: ", lastSignal); } } //+------------------------------------------------------------------+I created an EA with Schaff trend cycle . it is suppose to buy when green and sell when red but somehow its not doing what its suppose to do . it will either stay on sell or on buy . I have attached a screenshot and the Schaff trend cycle . Any idea how to fix this . I use the icustom function and use default shaff trend cycle input values thats in the indicator iuself thats why didnt insert in Icustom .