Skip to content

Instantly share code, notes, and snippets.

@rubens-shoji
Created January 2, 2019 12:09
Show Gist options
  • Save rubens-shoji/948230c623e4be55f7bd1a2e638bffd5 to your computer and use it in GitHub Desktop.
Save rubens-shoji/948230c623e4be55f7bd1a2e638bffd5 to your computer and use it in GitHub Desktop.
Exemplo usando a classe PositionInfo
// include no topo
#include <Trade\PositionInfo.mqh>
// declaracao no topo
CPositionInfo Position;
// OnInit ou OnTick
Position.SelectByIndex(0);
double Distancia = Position.PriceOpen() - Position.PriceCurrent();
// se for negativo multiplica por -1
if (Distancia < 0) Distancia = Distancia * -1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment