• Overview
  • Reviews
  • Comments

TradeSignal

Library for an Expert Advisor. It generates a trade signal.

The function works conservatively, but it works well with trend reversals.

Disadvantage: shows a rapid trend reversal with a delay. Usually prohibits trading for a while.

Advantage: does not give false signals during a sluggish trend.

The function returns:

  • 0 = Flat
  • 1 = Buy
  • -1 = Sell


Function parameters:

  • TF - timeframe in minutes
  • Period_1 - the number of periods for indicator 1
  • Period_2 - the number of periods for indicator 2
  • Differ_1 - the value with which the data given by the indicator 1 are compared
  • Differ_2 - the value with which the data given by the indicator 2 are compared
  • ShowTrendLines - enable/disable displaying the trend lines on the chart


Importing the function from the library

#import "signal.ex4"
int t_Signal(int tf=1,int perBig=0,int perLittl=0,int difBig=0,int difLittl=0,bool draw=true);
#import


Example of use in Expert Advisors

input  int TF                =60;    
input  int Period_1          =150;  
input  int Period_2          =60;    
input  int Differ_1          =4;    
input  int Differ_2          =20;
sinput bool  ShowTrendLines  =true;

bool UP=false, DN=false;

// ---------------------------------------

void OnTick() {

 int signal=t_Signal(TF,Period_1,Period_2,Differ_1,Differ_2,ShowTrendLines);
       UP=false; DN=false;
          if(signal ==  1) UP=true;
          if(signal == -1) DN=true; 

} //-- OnTick()


The example shows the recommended settings for GBPUSD.

Not the easiest pair, so the basic setup of the code (calculation parameters) was performed on it.

I recommend working with virtual or usual stop orders with a distance to the opening level equal to 65 points. (4 Digits).

It is useful to move the order after the price in steps of 15pt.

The function gives a steady signal. The orders are generally moved by trailing. For this reason, you do not need to reduce the distance. This will significantly increase the risk of a loss.

No reviews