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 EA

명시

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%
무료
비슷한 주문
We're expanding our network of remote translators for upcoming projects involving business, technical, and general documents. Requirements: - Native or near-native proficiency in the target language - Excellent communication skills - Commitment to quality and deadlines Apply by submitting your proposal, language pair(s), and relevant experience
┌─────────────┐ │ SMC ROBOT │ │ v2.0 │ └─────────────┘ [ANTENNA] │ ╔════════╧════════╗ ║ HEAD UNIT ║ ║ ┌───────────┐ ║ ║ │ ◉ ◉ │ ║ ← Optical Sensors ║ └───────────┘ ║ ╚════════╤════════╝ │ ╔════════╧════════╗ ║ TORSO ║ ║ ┌───────────┐ ║ ║ │ SMC CORE │ ║ ← Processing Unit ║ │ ARM V9 │ ║ ║ └───────────┘ ║ ║ [||||||||||] ║ ← Power Indicator ╚═══╤═══════╤════╝ │ │ ┌───┘ └───┐
I already have the source code of an MT5 Expert Advisor. The EA is about 70% complete. I need someone to modify and complete it. Requirements: • Manage EURUSD only. • Manage manual trades only (Magic Number = 0). • Support unlimited manual positions simultaneously. • Automatically add a 10-pip Stop Loss if a position has no Stop Loss. • Automatically add a 10-pip Take Profit if a position has no Take Profit. • Do not
I am looking for an expert MQL5 developer to build a robust, professional Expert Advisor for Gold (XAUUSD). The EA must be Event-Driven (OnTick) with no 'Sleep' functions, ensuring instant execution. ​ Core Logic: ​ Grid Strategy: Start with 0.02 Buy/Sell. Lot size sequence: 0.02, 0.03, 0.05, 0.09, 0.14, 0.26, 0.44, 0.75, 1.28, 2.18 (Max 10 steps). ​ Dynamic TP: Total basket TP must update instantly upon new order
I am currently using the attached Arbitrage MACD indicator. However, there are no signal alerts associated with this indicator. I would like to receive notifications on my android device the bar after a blue long arrow appears and the bar after a red short arrow appears. This is the current code: //+------------+-----------------------------------------------------+ //| v.22.04.07 | ArrZZx2.mq4 |
NT8 to mt6 trade copier 150 - 250 USD
I just copy and past what i need Features Opening and closing orders at market and limit price Copy Take Profit / Stop loss orders Trades are manually by using the "Chart Trader Feature" within NT8-Charts or separate Window. Advanced symbol and Lot mapping Blazing fast – copy as fast as 10 ms Copy multiple symbols in parallel In the Case that the connection between NT8 and MT5 is lost, including a solution to
Project Overview: I am looking for an expert MetaTrader 5 (MT5) developer/architect to build a highly optimized, professional-grade Trade Copier system. This is NOT a basic trade copier. It requires advanced execution handling, bypass mechanisms, strict risk management, and multi-threaded syncing. Here are the complete requirements for the project: 1. Architecture & Topology: Multi-Account Routing: Must support both
: Hello, I am looking for an experienced MQL4 developer to create a custom Binary Options Trading Bot for MetaTrader 4 (MT4). The bot needs to automate trades based on clear conditions and must have a reliable integration feature. I would like the bot to work smoothly with Telegram so that it can either receive signals from a channel/group or send instant trade notifications directly to my Telegram. The code should
I am looking for an experienced MQL4 developer to create an Expert Advisor (EA) based on signals from a custom indicator. Requirements: 1. The EA must use a single custom indicator that draws buy and sell arrows directly on the chart. 2. When a buy arrow appears, the EA should wait until the current candle closes. If the arrow is still present after the candle closes, it should open a BUY trade. 3
Bhokhwe 30 - 200 USD
//+------------------------------------------------------------------+ //| ThreeBullEMA10EA | //| Strategy: 3 Bullish + EMA10 Break | //+------------------------------------------------------------------+ #property strict extern double LotSize = 0.01; extern int Slippage = 3; extern int MagicNumber = 12345; extern int EMA_Period = 10;

프로젝트 정보

예산
20 - 100 USD
기한
에서 1  3 일