I need a simple EA program based on RVI study (calculations included). The original program was written in Thinkscript. I need that converted to MQL4

MQL4 전문가

명시

Hi,  I need an EA based on the following thinkscript program. The program is simple and self explanatory. Let me know if there are any questions.  I will need the actual script of the program so that I can  modify it.  

 Thank you. 

Input RVIlength =2;

Input Investment = 1000;

input No_Share_To-Buy =  Investment /close;


def highPrice = StDev(high, 2);

def lowPrice = StDev(low, 2);
def highAvgUp = ExpAverage(if high > high[1] then highPrice else 0, RVIlength);
def highAvgDown = ExpAverage(if high < high[1] then highPrice else 0, RVIlength);
def lowAvgUp = ExpAverage(if low > low[1] then lowPrice else 0, RVIlength);
def lowAvgDown = ExpAverage(if low < low[1] then lowPrice else 0, RVIlength);
def highRVI = 100 - 100 / (300 + highAvgUp / highAvgDown);
def lowRVI = 100 - 100 / (300 + lowAvgUp / lowAvgDown);
def RVI = (highRVI + lowRVI) / 2;

 

//the following  is a simple moving average//

def AVGRVI =  (MovingAverage(data = RVI, length =RVIlength));

def AvgRVI_V = if AVGRVI[-1]-AVGRVI>0 and AVGRVI-AVGRVI[1]<0 then 1 else 0;

def AvgRVI_H = if AVGRVI[-1]-AVGRVI<0 and AVGRVI-AVGRVI[1]>0 then 1 else 0;

def AVGRVI_Slope_Up = if AVGRVI-AVGRVI[1] >0 then 1 else 0;

def AVGRVI_Slope_down = if AVGRVI-AVGRVI[1] >0 then 1 else 0; 

/////////////////////////////////////////////////////////////////////////////////////////////////////// 

//And here are the Buy to Open (BTO), Sell to Close (STC) and STO and BTC sell signals:

def BTO = if AvgRvi_Valley==1 and AVGRVI_Slope_Up==1  then 1 else 0;

def STC = if  AvgRvi_hill==1   then 1 else 0;

def STO = if AvgRvi_hill[1]==1  and AVGRVI_Slope_Down==1  then 1 else 0;

def BTC = if AvgRvi_Valley[-1]==1 then 1 else 0;

//Please note that every STO is exactly one tick after the STC and every BTO is exactly one tick following the BTC (ie, the entire pairs chart is divided into buy or sell with no gaps in between unless the sale is going in the wrong direction within 3 ticks of the purchase. In other words, if the BTO doesn't generate a profit of any amount within the first three ticks, I'd take the loss in that trade and close the position. Same thing for STO positions. That too needs to lead to a positive P&L within the first three ticks (I don't care if after the third tick it doesn't generate a positive P&L-as a matter of fact, I would like the program to disregard the P&L past the first three ticks and not to close the position). The way I programmed that in Thinkscript is to assign a Timer to keep track of the P&L within only the first three ticks of any new BTO or STO signals.  IN MQL there may be easier ways to accomplish this than in thinkscript, but the following is my explanation of my workaround this issue which may help. 

 //The following will keep track of how many ticks has passed since the position was first opened regardless of how many more open signals are generated between that time and the time this trade position is closed  

Def BTO/STO_Timer = if (BTO ==1 or STO==1) then BTO/STO_Timer[1]+1 else if (STC ==1 or BTC==1) then 0 else BTO/STO_Timer[1]+1

//the following will remember the opening price of each position regardless of how many more Open signals are generated between that time and the time this trade position is closed  

Def BTO/STO_Price = if (BTO == 1 or STO ==1)  then Close else if (STC == 1 or BTC==1) then 0 else BTO/STO_Price[1];

//the following will generate the close signals if the P&L within the first three ticks of the new position is not going in the right direction.   

def StopLoss_STC = if BTO_Price > close and BTO[3]==1 and BTO/STO_Timer[3]<3 then 1 else  0;

def StopLoss_BTC = if STO_Price < close and STO[3] ==1 and BTO_Timer[3]<2 then 1 else 0;

  /////////////////////////////////////////////////////////////////////////////////////////////////////

//Lastly I need to Generate the BTO  and STO...  signals to auto_purchase the number of units as calculated in  "No_Share_To-Buy" with the signal above,

//I  need to generate STC  signal which closes the position  with either STC or StopLoss_STC

// and  to generate BTC  signal which closes the position with either BTC or StopLoss_BTC

 

BTW, I don't care if the program is in MQL4 or MQL5. Whichever is more convenient. 

Thank You,


David 

응답함

1
개발자 1
등급
(195)
프로젝트
395
28%
중재
155
20% / 52%
기한 초과
112
28%
무료
2
개발자 2
등급
(46)
프로젝트
73
16%
중재
13
8% / 92%
기한 초과
37
51%
무료
비슷한 주문
Experts mt5 30 - 50 USD
I need a programmer to create an MT5 robot, putting my strategy inside it, send me a message if you are interested! The robot will be based on averages making purchases and sales together
To develop EA algo on GBPUSD on MT5 Client will provide the necessary indicator which will plot Daily pivots on the chart. PFA screenshot attached for details of job work
Hello, my budget is 30$, I need MT5 EA send alert to telegram: 1. Send alert if any position volume by magic number more than: for example, 0.25 lot, send position symbol name and positions not all positions just the positions are more than 0.25 lot volume and positions trade comment and send Custom comment: I entered it manually in input menu. 2. Send alert if I have open positions by magic number in
Description de la stratégie de trading : Bot de trading ULTIMATE AI Smart Money Concept (SMC) Aperçu: J'ai besoin du robot de trading IA ultime, conçu pour mettre en œuvre une stratégie de trading Smart Money Concept (SMC) axée sur l'identification des configurations de trading à forte probabilité en fonction de la structure du marché, des blocs d'ordres et de l'évolution des prix. Ce robot vise à capitaliser sur le
I’m looking for a skilled MQL5 developer to build an MT5 Expert Advisor that mirrors inverse trades (Buy ↔ Sell) from a prop firm challenge account (demo) to a live hedge account . Core Requirements: Open and close opposite trades in real-time Dynamic lot sizing based on account balances (Objective: recover approx. $500 if the challenge account fails) Support for multiple symbols , including: XAUUSD, NAS100, BTCUSD
Hi, I’m looking for an experienced MQL5 or AI trading systems developer who can build a scalable, beginner-friendly forex trading network . The system should include: Fully automated trading logic (AI-enhanced or rule-based) MT5 (or MT4 if needed) compatibility A beginner dashboard with simplified controls A structure that supports onboarding of multiple traders (eventually multi-asset) Key modules like performance
Trading Strategy Description: ULTIMATE AI Smart Money Concept (SMC) Trading Bot Overview: i need The ULTIMATE AI trading bot that is designed to implement a Smart Money Concept (SMC) trading strategy that focuses on identifying high-probability trading setups based on market structure, order blocks, and price action. The bot aims to capitalize on institutional trading behavior by analyzing price movements and
I need someone who can provide metatrader4/5 restful api. And I want restful and websockets. we need to use metatrader api in our app for statistics and trade copying. Apply only if you have the necessary qualifications and experience for this project
GOLD KILLER 1099+ USD
TELL ME SELL OR BUY DON’t BLOW ACCOUNT. THE ROBOT IS FAST ON TAKING TRADING ON MONDAY AND CPI NFP AND EVEY THING I WILL NOT SELL THE BOT ITS FREE
I need a highly disciplined, low-risk EA for MT4/MT5 that trades only when 100% strategy conditions are met. It must include multi-timeframe trend logic, support/resistance rejection, BOS/CHoCH detection from real swing levels, and a breakout strategy with trailing SL. EA should scan all major pairs (from one chart), trade only during 07:00–16:00 GMT, and skip trades 2 hours before major news. Max 1 trade per pair

프로젝트 정보

예산
20 - 100 USD
개발자에게
18 - 90 USD
기한
에서 1  3 일