• Latest
  • Trending
  • All
  • Market Updates
  • Cryptocurrency
  • Blockchain
  • Investing
  • Commodities
  • Personal Finance
  • Technology
  • Business
  • Real Estate
  • Finance
Soft Manager – Trading Ideas – 5 August 2025

My useful functions in mql4 language – Trading Ideas – 14 September 2025

September 14, 2025
Warren Buffett will release a letter to shareholders on November 10

Warren Buffett will release a letter to shareholders on November 10

November 2, 2025
Bitcoin Price In The Final Stage Of Bull Cycle — When Is The Peak?

Bitcoin Price In The Final Stage Of Bull Cycle — When Is The Peak?

November 2, 2025
FTX EU Buyer Backpack Goes Live In Europe

FTX Creditors May Recover as Little as 9% After Adjusting for Crypto Prices

November 2, 2025
Adobe’s experimental AI tool can edit entire videos using one frame

Adobe’s experimental AI tool can edit entire videos using one frame

November 2, 2025
Wearing the Meta Ray-Bans’ successor left me with two verdicts (and you’ll want to hear both)

Wearing the Meta Ray-Bans’ successor left me with two verdicts (and you’ll want to hear both)

November 2, 2025
Soft Manager – Trading Ideas – 5 August 2025

Momentum Hunter Expert Advisor (MT4 & MT5) – Trading Systems – 1 November 2025

November 2, 2025
Saxo Bank Japan Broadens European Stock Offering, Including UBS and Ferrari

Saxo Bank Japan Broadens European Stock Offering, Including UBS and Ferrari

November 2, 2025
Gen X Is Hoping To Retire Like Boomers: Here’s Why They Can’t

Gen X Is Hoping To Retire Like Boomers: Here’s Why They Can’t

November 2, 2025
Bitcoin In IPO Phase As Early Holders Give Way to New Investors

Bitcoin In IPO Phase As Early Holders Give Way to New Investors

November 2, 2025
Two Apple devices you really shouldn’t buy this month (and 9 that are safe for now)

Two Apple devices you really shouldn’t buy this month (and 9 that are safe for now)

November 2, 2025
Newsquawk Week Ahead: US PCE, PBoC MLF, ECB minutes, Aus CPI, Canada GDP, NVDA earnings

Newsquawk Week Ahead: US ISM PMIs, ADP, Supreme Court Tariff Hearing, RBA, BoE, OPEC-8

November 2, 2025
Bitcoin turns 17 – Can BTC overcome its first ‘red October’ since 2018?

Bitcoin turns 17 – Can BTC overcome its first ‘red October’ since 2018?

November 2, 2025
Sunday, November 2, 2025
No Result
View All Result
InvestorNewsToday.com
  • Home
  • Market
  • Business
  • Finance
  • Investing
  • Real Estate
  • Commodities
  • Crypto
  • Blockchain
  • Personal Finance
  • Tech
InvestorNewsToday.com
No Result
View All Result
Home Investing

My useful functions in mql4 language – Trading Ideas – 14 September 2025

by Investor News Today
September 14, 2025
in Investing
0
Soft Manager – Trading Ideas – 5 August 2025
491
SHARES
1.4k
VIEWS
Share on FacebookShare on Twitter


LIST

  1. Normalize lot
  2. Shifting datain an array
  3. Reviewing all symbols out there overview
  4. Variable kind conversion
  5. Opening an order (binary choices)
  6. Seek for Fibonacci ranges
  7. Urgent the button (object)
  8. Truncation of characters within the software value
  9. Splitting a string into parts
  10. Code execution on the primary tick of a brand new bar
  11. MultiTimeFrame
  12. Launching an advisor on a Renko (offline) chart

…

There are conditions when you might want to spherical lots.

For instance, in martingale when multiplying lots.

To do that, we have to know to which decimal place we have to spherical.

string stepS=string(MarketInfo(_Symbol,MODE_LOTSTEP));
int nor_lot=0;
if(StringFind(stepS,".")!=-1) nor_lot=MathAbs(StringFind(stepS,".")-StringLen(stepS)+1);

double Lot_rounded=NormalizeDouble(4887.897,nor_lot) 

2. Shifting information in an array

On this code, we copy the array into itself however with a shift.

Shift the info again by 2 parts. (The sixth turns into the 4th, and so on.)

Uncopied parts (far proper of the ‘shift’ amount) will retain their values.

double buf[6]={2.33,4,8,6,7,8.8};
int shift=2;
ArrayCopy(buf,buf,0,shift); 

Transfer ahead by 1 ingredient.

Uncopied parts (far left of the ‘shift’ amount) will retain their values.

double buf[6]={2.33,4,8,6,7,8.8};
int shift=1;
ArrayCopy(buf,buf,shift,0); 

3. Reviewing all symbols out there overview

On this code, we discover out what symbols we’ve  and write them to the buffer.

The variable ‘all_pairs’ is chargeable for choosing forex pairs from the MarketWatch record (plus pairs utilized by operating indicators, scripts, or buying and selling advisors) or from all forex pairs offered by the dealer, together with hidden ones.

bool all_pairs=false;

int symbols_tot=SymbolsTotal(all_pairs);
string symbols[]; ArrayResize(symbols,symbols_tot);

for(int i=0;i<symbols_tot;i++)
{
  symbols[i]=SymbolName(i,all_pairs);
}

4. Variable kind conversion

If, for instance, you might want to convert a variable kind from datetime to string, you are able to do it like this.

datetime time_cur=TimeCurrent();
Alert(TimeToString(time_cur)); 

You may write it that method.

datetime time_cur=TimeCurrent();
Alert(string(time_cur)); 

5. Opening an order (binary choices)

The one distinction is within the touch upon the order. It is advisable to write it down like this.

enter int expiration_minits = 5;
...
OrderSend(Image(),OP_BUY,Lot,Ask,0,0,0,"BO exp:"+string(expiration_minits*60),Magic,0,clrNONE); 

6. Seek for Fibonacci ranges

You can not discover out the costs of the degrees themselves. You may solely calculate them.

 string name_fibo="Fibo";


  int ranges=int(ObjectGetInteger(0,name_fibo,OBJPROP_LEVELS));
  double fib_prices[]; ArrayResize(fib_prices,ranges);
  double price_lev0=ObjectGetDouble(0,name_fibo,OBJPROP_PRICE,1);
  double price_lev100=ObjectGetDouble(0,name_fibo,OBJPROP_PRICE,0);
  bool wayUP=false; if(price_lev0<price_lev100) wayUP=true;
  double perc100_points=MathAbs(price_lev0-price_lev100);


     double stage=0;
     for(int i=0;i<ranges;i++)
     {
      stage=ObjectGetDouble(0,name_fibo,OBJPROP_LEVELVALUE,i);
      if(wayUP) fib_prices[i]=price_lev0+perc100_points*stage;
      else
      fib_prices[i]=price_lev0-perc100_points*stage;     
     } 

     for(int i=0;i<ranges;i++)
     {
     Alert(fib_prices[i]);
     }

7. Urgent the button (object)

OnChartEvent() doesn’t work within the tester. Nevertheless, there’s one common answer for urgent the button within the tester and dwell buying and selling.

 if(ObjectGetInteger(0,"BUY_button",OBJPROP_STATE))

{

ObjectSetInteger(0,"BUY_button",OBJPROP_STATE,false);

... 

} 

8. Truncation of characters within the software value

Solely works for costs. If it is one thing else, then as a substitute of Digits, you might want to write a quantity that is the same as the variety of decimal locations.

enter int Characters_delete = 1;
...
string information=DoubleToString(Bid,Digits); 
string resoult=StringSubstr(information,0,StringLen(information)-Characters_delete); 

9. Splitting a string into parts

For instance, we have to break up a string with tons and place them in a buffer.

enter string Heaps="0.01,0.03,0.06";
...
string str_spl[];
int measurement=StringSplit(Heaps,StringGetCharacter(",",0),str_spl);
ArrayResize(lots_buf,measurement);

for(int i=0;i<measurement;i++)
{
lots_buf[i]=double(str_spl[i]);
} 

for(int i=ArraySize(lots_buf)-1;i>=0;i--)
{
Alert(lots_buf[i]);
} 

10. Code execution on the primary tick of a brand new bar

First choice.

All code past this level can be executed on the primary tick of the brand new bar.

int prev_bars=0;
...
if(prev_bars==Bars) return;
prev_bars=Bars; 

Second choice.

The code in sq. brackets can be executed on the primary tick of the brand new bar.

int prev_bars=0;
...
if(prev_bars!=Bars)
{
prev_bars=Bars;
} 

When you might want to calculate information from the senior TF. For instance, RSI.

enter ENUM_TIMEFRAMES TF = PERIOD_CURRENT;
double rsi_buf[];
...
for(int i=0;i<Bars-(IndicatorCounted()-1);i++)
{
rsi_buf[i]=iRSI(Image(),TF,14,iBarShift(Image(),TF,Time[i]));
} 

12. Launching an advisor on a Renko (offline) chart

Renko is an offline chart.

A brand new tick won’t trigger the advisor code to begin executing.

It is advisable to use this development.

double prev_bid;

 int OnInit()
 {  
 
 if(ChartGetInteger(0,CHART_IS_OFFLINE))
 {
 prev_bid=Shut[0];

 whereas(!IsStopped())
 {
 RefreshRates();
  if(prev_bid!=Shut[0]) {prev_bid=Shut[0];OnTick();}
 Sleep(100);
 }
 }



 return(INIT_SUCCEEDED);
} 



Source link

Tags: Functionsideaslanguagemql4Septembertrading
Share196Tweet123
Previous Post

S&P 500 Futures Analysis & Forecast: 6600 Rejected as SPX Options Pin; Levels for the Week

Next Post

Should you upgrade to an iPhone 17 Pro from last year’s model? I am – here’s why

Investor News Today

Investor News Today

Next Post
Should you upgrade to an iPhone 17 Pro from last year’s model? I am – here’s why

Should you upgrade to an iPhone 17 Pro from last year's model? I am - here's why

  • Trending
  • Comments
  • Latest
Private equity groups prepare to offload Ensemble Health for up to $12bn

Private equity groups prepare to offload Ensemble Health for up to $12bn

May 16, 2025
The human harbor: Navigating identity and meaning in the AI age

The human harbor: Navigating identity and meaning in the AI age

July 14, 2025
Equinor scales back renewables push 7 years after ditching ‘oil’ from its name

Equinor scales back renewables push 7 years after ditching ‘oil’ from its name

February 5, 2025
Niels Troost has a staggering story to tell about how he got sanctioned

Niels Troost has a staggering story to tell about how he got sanctioned

December 14, 2024
Why America’s economy is soaring ahead of its rivals

Why America’s economy is soaring ahead of its rivals

0
Dollar climbs after Donald Trump’s Brics tariff threat and French political woes

Dollar climbs after Donald Trump’s Brics tariff threat and French political woes

0
Nato chief Mark Rutte’s warning to Trump

Nato chief Mark Rutte’s warning to Trump

0
Top Federal Reserve official warns progress on taming US inflation ‘may be stalling’

Top Federal Reserve official warns progress on taming US inflation ‘may be stalling’

0
Warren Buffett will release a letter to shareholders on November 10

Warren Buffett will release a letter to shareholders on November 10

November 2, 2025
Bitcoin Price In The Final Stage Of Bull Cycle — When Is The Peak?

Bitcoin Price In The Final Stage Of Bull Cycle — When Is The Peak?

November 2, 2025
FTX EU Buyer Backpack Goes Live In Europe

FTX Creditors May Recover as Little as 9% After Adjusting for Crypto Prices

November 2, 2025
Adobe’s experimental AI tool can edit entire videos using one frame

Adobe’s experimental AI tool can edit entire videos using one frame

November 2, 2025

Live Prices

© 2024 Investor News Today

No Result
View All Result
  • Home
  • Market
  • Business
  • Finance
  • Investing
  • Real Estate
  • Commodities
  • Crypto
  • Blockchain
  • Personal Finance
  • Tech

© 2024 Investor News Today