Spécifications
The EA tracks the price of an instrument on a candle and when it falls within a predefined range, it opens a trade. For example, the current price of an instrument like usd/jpy is 147.536. For the ea, it needs 3 things, a midpoint, upper limit and lower limit. So the midpoint values are half a unit, units,tens or hundreds. For units - 147.000, 146.000, 145.000 and so on. For tens - 130.000,140.000,150.000 etc. For half a unit - 147.000, 147.500, 148.000, 148.500, etc. The upper and lower limits can be set as certain pips away from midpoint.
Example 1: For a units midpoint, assuming 145.000 with upper and lower limit of 0.3. Open trade if price falls between 144.700 and 145.300
Example 2: For a tens midpoint, assuming 140.000 with upper limit of 1.5 and lower limit of 3.0. Open trade if price falls between 137.000 and 141.500
When set to a chosen midpoint, the ea will consider all possible values. The upper and lower limit is not dependent on the midpoints, which means a midpoint can be set to ‘hundreds’ and the limit values don’t have to be hundreds. It can be 10 pips or 1.5pips or even 0.5pips. Also, keep in mind all instruments have different price values. Some derived instruments can have prices in thousands like 3726.1598 and other instruments like eur/usd have prices like 1.10265. But the ea should work for all cases(keep this in mind for the sl and tp variables). For obvious reasons, any midpoint above units would not work on eur/usd, but for the derived instruments a hundreds and thousands midpoint would work. So just need something that works regardless of the instrument being traded. When in use, the variables will be adjusted to fit the current instrument.
The trade will close when sl or tp is hit. Or it will close when the current candle closes (if the option is set to true)
Variables/Inputs:
Price track - always or at the close of a candle - checking the price constantly or checking closing price alone.
Open trade - immediately or new candle
Midpoint - half unit, units, tens, hundreds etc. You can make these integers instead of strings if you want - 0.5,1,10,100,1000 etc.
Upper limit - int/float - number of upward pips
Lower limit - int/float - number of downward pips
Trade type - buy/sell - trade to open based on signal
Lot size - int/float
SL - number of pips - if set to 0, no sl
TP - number of pips - if set to 0, no tp
Close trade after present candle closes - boolean - true/false
This should be straightforward and simple, thanks.