Author: Copyright � 2008, Tinytjan
Logical

This script serves as a foundational toolkit designed to simplify how complex instructions are handled within the trading platform. Instead of making the underlying code cluttered or difficult to manage, it provides three specialized "decision-making" shortcuts and one administrative utility to keep the software running smoothly.

Smart Decision Making

The core logic of this script revolves around simplified "If/Then" scenarios. In everyday language, these functions allow the program to quickly choose between two different options based on a single condition. Depending on what type of information the script is processing, it uses three specific variations:

  • Numeric Decisions: This handles situations involving prices or decimals (like currency rates). It checks a condition and instantly picks the correct price value to use.
  • Whole Number Decisions: This is used for counting items or identifying specific positions (like the number of trades open). It chooses the appropriate whole number based on the current market status.
  • Textual Decisions: This handles words or labels. It allows the script to display different messages or data labels depending on whether a specific condition has been met.

By using these shortcuts, the program can make rapid-fire choices—such as deciding which price to trade at or what text to show on your screen—without unnecessary complexity.

Operational Management

In addition to making decisions, the script includes a specialized "Holding" mechanism. This ensures that the software remains active and responsive. It creates a steady loop that keeps the script running in the background, essentially telling the platform to stay awake and continuously monitor for updates until you manually stop the program.

Summary for the User

Think of this script as a set of "Smart Switches." It provides the system with the ability to react instantly to market conditions by choosing the correct price, number, or message automatically, while simultaneously ensuring the software stays active and ready to perform its tasks without interruption.

10 Views
0 Downloads
0 Favorites
Logical
//+------------------------------------------------------------------+
//|                                                      Logical.mq4 |
//|                                       Copyright © 2009, Tinytjan |
//|                                                 tinytjan@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Tinytjan"
#property link      "tinytjan@mail.ru"
#property library

/// \brief Equal to ternar operator 
/// needed = Condition ? IfTrue : IfFalse;
/// \param IfTrue
/// \param IfFalse
/// \return matching value from parameters
double DoubleIf(bool Condition, double IfTrue, double IfFalse)
{
   if (Condition) return (IfTrue);
   else           return (IfFalse);
}

/// \brief Equal to ternar operator 
/// needed = Condition ? IfTrue : IfFalse;
/// \param IfTrue
/// \param IfFalse
/// \return matching value from parameters
int IntIf(bool Condition, int IfTrue, int IfFalse)
{
   if (Condition) return (IfTrue);
   else           return (IfFalse);
}


/// \brief Equal to ternar operator 
/// needed = Condition ? IfTrue : IfFalse;
/// \param IfTrue
/// \param IfFalse
/// \return matching value from parameters
string StringIf(bool Condition, string IfTrue, string IfFalse)
{
   if (Condition) return (IfTrue);
   else           return (IfFalse);
}

/// \brief Use this function to stuck your code
void Stuck()
{
   while(!IsStopped())
   {
      Sleep(100);
   }
}

Comments