Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.69 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.69 KB

CandleTrailing

Logic to determine if the current price is cheap or expensive in candlestick.

Description

First of all, this logic waits X% for candlestick formation. For example, if it is set to wait 50% on the daily chart, you will have to wait for half a day.
It is 30 minutes if it is 50% on 1 hour foot.

When the wait time is over, we record high and low candlesticks at that point.
It is a logic aimed at generating a buying signal at a price higher than the high price at this time and a selling signal at a price cheaper than the low price.

However, there is a possibility that this high / low will still be renewed, so if you generate a signal just by exceeding high price and low price, you will miss entries with better price.
Therefore, using the trailing stop method, we will update the price of signal generation every time we update highs and lows. From updating of high and low prices, if only Ypips goes backwards, it generates a signal.
(Conditions for backlighting are conditions that are more favorable than highs and lows at the end of waiting time)

Requirement

Install

  • Download CandleTrailing.mqh
  • Save the file to /MQL4/Includes

Usage

Includes header file.
#include <CandleTrailing.mqh>

Create an instance.
The first argument of the constructor is the trailing width (pips), and the second argument is the percentage of waiting time (%).

CandleTrailing *CT;

int OnInit()
{
   CT = new CandleTrailing(1, 50);
   return(INIT_SUCCEEDED);
}

It receives the judgment and executes processing according to the result.
0: No signal, 1: buy signal, -1: sell signal
int signal = CT.Signal();