//--------------------------------------------------------------------
// Pseudo Source Code of EURUSD_H4_Strategy 0.2878463
//
//   Generated by StrategyQuant X Build 125 for MetaTrader
//   at 11/27/2019 23:25
//--------------------------------------------------------------------

//--------------------------------------------------------------------
//  Strategy Parameters
//--------------------------------------------------------------------
int MagicNumber = 11111;
int QQERSIPeriod = 13;
int QQERSIPeriod2 = 14;
int QQERSIPeriod3 = 23;
int RSIPeriod = 185;
int RSIPeriod2 = 50;
int Period = 10;
int Period2 = 20;
double PriceEntryMult = 1.3;
int BarsValid = 19;
int TrailingStop = 48;
int ATRPeriod = 14;
double PriceEntryMult2 = 1.5;
int BarsValid2 = 4;
int BollingerBandsPeriod = 10;
int ATRPeriod2 = 40;

Main chart = Current Symbol / Current TF;

//--------------------------------------------------------------------
// Trading rule: Trading signals (On Bar Open)
//--------------------------------------------------------------------                   
LongEntrySignal = (((QQE(Main chart,QQERSIPeriod, 13, 3.8)[2] < QQE(Main chart,QQERSIPeriod2, 5, 4.2)[4])
   and (QQE(Main chart,QQERSIPeriod2, 5, 4.2)[1] < QQE(Main chart,QQERSIPeriod3, 8, 2.5)[4]))
   and (RSI(Main chart,RSIPeriod, PRICE_CLOSE)[1] > RSI(Main chart,RSIPeriod2, PRICE_CLOSE)[5]));

ShortEntrySignal = (Highest(Main chart, Period, PRICE_TYPICAL)[3] > Lowest(Main chart, Period2, PRICE_CLOSE)[1]);

LongExitSignal = false;

ShortExitSignal = false;



//--------------------------------------------------------------------
// Trading rule: Long entry (On Bar Open)
//--------------------------------------------------------------------                   
if LongEntrySignal
{
    // Action #1
    Open Long order at (Highest(Main chart, Period2, PRICE_CLOSE)[3] - (PriceEntryMult * ATR(Main chart,ATRPeriod)[4])) Stop;
        Order valid for BarsValid bars;
        Duplicate trades: allowed; 
        Replacing pending orders: allowed; 
        

        Trailing Stop = TrailingStop pips;

}


//--------------------------------------------------------------------
// Trading rule: Short entry (On Bar Open)
//--------------------------------------------------------------------                   
if (ShortEntrySignal
   and Not LongEntrySignal)
{
    // Action #1
    Open Short order at (BollingerBands(Main chart,BollingerBandsPeriod, 1.9, PRICE_CLOSE).Upper[5] + (PriceEntryMult2 * ATR(Main chart,ATRPeriod2)[2])) Stop;
        Order valid for BarsValid2 bars;
        Duplicate trades: allowed; 
        Replacing pending orders: allowed; 
        

}


//--------------------------------------------------------------------
// Trading rule: Long exit (On Bar Open)
//--------------------------------------------------------------------                   
if ((LongExitSignal
   and Not LongEntrySignal)
   and (MarketPosition("Any", MagicNumber, "") is Long))
{
    // Action #1
    Close Full position for Symbol = Any and Magic Number = MagicNumber;

}


//--------------------------------------------------------------------
// Trading rule: Short exit (On Bar Open)
//--------------------------------------------------------------------                   
if ((ShortExitSignal
   and Not ShortEntrySignal)
   and (MarketPosition("Any", MagicNumber, "") is Short))
{
    // Action #1
    Close Full position for Symbol = Any and Magic Number = MagicNumber;

}




