Skip to content

Commit

Permalink
Fix convert ticks to points
Browse files Browse the repository at this point in the history
  • Loading branch information
erlonfs committed Sep 30, 2018
1 parent a8dd0ec commit 9e957b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
Binary file modified estrategy/first_candle-mini-dolar-config.set
Binary file not shown.
Binary file modified estrategy/first_candle-mini-indice-config.set
Binary file not shown.
Binary file modified first_candle.mq5
Binary file not shown.
21 changes: 15 additions & 6 deletions src/FirstCandle.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
#include <BadRobot.Framework\BadRobotUI.mqh>
#include <BadRobot.Framework\BadRobotPrompt.mqh>

class FirstCandle : public BadRobotUI
class FirstCandle : public BadRobotPrompt
{
private:
//Price
Expand All @@ -33,7 +33,7 @@ private:

if (order == ORDER_TYPE_BUY) {

double _entrada = _maxima + GetSpread();
double _entrada = _maxima + ToPoints(GetSpread());

if (GetLastPrice() >= _entrada) {

Expand All @@ -51,7 +51,7 @@ private:

if (order == ORDER_TYPE_SELL) {

double _entrada = _minima - GetSpread();
double _entrada = _minima - ToPoints(GetSpread());

if (GetLastPrice() <= _entrada) {

Expand Down Expand Up @@ -82,11 +82,11 @@ private:

for (int i = ArraySize(_rates) - 1; i >= 0; i--) {

if (_rates[i].high > _maxima + GetSpread() || _rates[i].low < _minima - GetSpread()) {
if (_rates[i].high > _maxima + ToPoints(GetSpread()) || _rates[i].low < _minima - ToPoints(GetSpread())) {
isMatch = false;
}

if (GetLastPrice() > _maxima + GetSpread() || GetLastPrice() < _minima - GetSpread()) {
if (GetLastPrice() > _maxima + ToPoints(GetSpread()) || GetLastPrice() < _minima - ToPoints(GetSpread())) {
isMatch = false;
}

Expand Down Expand Up @@ -175,6 +175,10 @@ public:
void Load() {
LoadBase();
};

void UnLoad(const int reason) {
UnLoadBase(reason);
};

void Execute() {

Expand Down Expand Up @@ -205,6 +209,11 @@ public:
void ExecuteOnTrade(){
ExecuteOnTradeBase();
};

void ChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
{
ChartEventBase(id, lparam, dparam, sparam);
};

};

0 comments on commit 9e957b6

Please sign in to comment.