Formation Logo
Brijon Concept of Threes
MQ4 API
 
Functions

Trade Utility

Functions
Collaboration diagram for Trade Utility:

Functions

int Get_X_Digit_Multiplier ()
 Creates a multiplier that adapts pips to the proper criminal Digits.
bool SendSingleTrade (int type, string comment, double lotsize, double price, double stop, double take)
 This function sends a single trade, checks for errors and verifies it has been opened.
bool DoesTradeExist ()
 Does this trade exist for this magicNumber and Symbol.
void LookForTradingOpportunities ()
 Trade entry logic, This is specific to this method.
bool CloseTrade (int ticket)
 Close a trade by using a specific ticket number.
void LookForTradeClosure ()
 Close the trade if appropriate.
void GetTradeDirection ()
 Get Trade direction.
int GetMultiplier ()
 Returns a multiplying factor to turn the result of price calculations into full pips.
bool O_R_CheckForHistory (int ticket)
 This function is to work around a very annoying and dangerous bug in MT4: immediately after you send a trade, the trade may NOT show up in the order history, even though it exists according to ticket number.
void O_R_Sleep (double mean_time, double max_time)
 This sleeps a random amount of time defined by an exponential probability distribution.
string GetTradeDirectionFromTrend (int tf, int shift)
 Get the trade direction from the trend squalou coded this.

Function Documentation

bool CloseTrade ( int  ticket)

Close a trade by using a specific ticket number.

Parameters:
ticket- the ticket number to close

Definition at line 1434 of file Brijon_Concept_of_Threes_auto_trading_robot_by_Steve_Hopwood.mq4.

bool DoesTradeExist ( )

Does this trade exist for this magicNumber and Symbol.

Returns:
true if trade is Open

Definition at line 1290 of file Brijon_Concept_of_Threes_auto_trading_robot_by_Steve_Hopwood.mq4.

int Get_X_Digit_Multiplier ( )

Creates a multiplier that adapts pips to the proper criminal Digits.

Returns:
a multiplier to adapt pips inputs etc to x digit crims

Definition at line 667 of file Brijon_Concept_of_Threes_auto_trading_robot_by_Steve_Hopwood.mq4.

string GetTradeDirectionFromTrend ( int  tf,
int  shift 
)

Get the trade direction from the trend squalou coded this.

Cheers, sq.

Definition at line 2180 of file Brijon_Concept_of_Threes_auto_trading_robot_by_Steve_Hopwood.mq4.

void LookForTradingOpportunities ( )

Trade entry logic, This is specific to this method.

Here lies the meat and potatoes of the EA See the Main Page for detailed explanation Sends trade if conditions are met

Definition at line 1318 of file Brijon_Concept_of_Threes_auto_trading_robot_by_Steve_Hopwood.mq4.

bool O_R_CheckForHistory ( int  ticket)

This function is to work around a very annoying and dangerous bug in MT4: immediately after you send a trade, the trade may NOT show up in the order history, even though it exists according to ticket number.

As a result, EA's which count history to check for trade entries may give many multiple entries, possibly blowing your account!

This function will take a ticket number and loop until it is seen in the history.

Returns:
TRUE if successful, FALSE otherwise

FEATURES: Re-trying under some error conditions, sleeping a random time defined by an exponential probability distribution.

Displays various error messages on the log for debugging.

ORIGINAL AUTHOR AND DATE: Matt Kennel, 2010

Definition at line 2072 of file Brijon_Concept_of_Threes_auto_trading_robot_by_Steve_Hopwood.mq4.

void O_R_Sleep ( double  mean_time,
double  max_time 
)

This sleeps a random amount of time defined by an exponential probability distribution.

The mean time, in Seconds is given in 'mean_time'. This returns immediately if we are backtesting and does not sleep.

Definition at line 2140 of file Brijon_Concept_of_Threes_auto_trading_robot_by_Steve_Hopwood.mq4.

bool SendSingleTrade ( int  type,
string  comment,
double  lotsize,
double  price,
double  stop,
double  take 
)

This function sends a single trade, checks for errors and verifies it has been opened.

Parameters:
type- Enumberation OP_BUY,OP_SELL, ect...
comment- textual comment by user
lotsize- number of lots
price- Preferred price of trade
stop- stop loss
take- take profit level
Returns:
true if successful

Definition at line 1197 of file Brijon_Concept_of_Threes_auto_trading_robot_by_Steve_Hopwood.mq4.

Make Controller Kit
 
Brijon