Thanks. Ive tried editing it but ive almost scattered the entire code. How can i edit this please to add the buy on next bar instead of immediately i.e either at close price of present candle or at new candle open price. Or even to tell it to check the last bar if conditions were met then trigger buy (dont think it would work well but what do i know)
Thanks. Ive tried editing it but ive almost scattered the entire code. How can i edit this please to add the buy on next bar instead of immediately i.e either at close price of present candle or at new candle open price. Or even to tell it to check the last bar if conditions were met then trigger buy (dont think it would work well but what do i know)
Your explanations are very confusing. In such cases, I recommend drawing a picture. In the picture, show the condition for the signal.
Thanks. Ive tried editing it but ive almost scattered the entire code. How can i edit this please to add the buy on next bar instead of immediately i.e either at close price of present candle or at new candle open price. Or even to tell it to check the last bar if conditions were met then trigger buy (dont think it would work well but what do i know)
iRSI simple advisor, version1.006
This is how the adviser works now: we check the signal ONLY AT THE MOMENT OF THE BIRTH OF A NEW BAR. The new bar has index # 0, we call the new bar "Current Bar". Example of a BUY signal: if the two previous bars (bar # 1 and bar # 2) are below the '30' line, this is a BUY signal:
Pic. 1. iRSI simple advisor, version1.006
The code:
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
//--- we work only at the time of the birth of new bardatetime time_0=iTime(Symbol(),Period(),0);
if(time_0==m_prev_bars)
return;
m_prev_bars=time_0;
//---double rsi_2=iRSIGet(2);
double rsi_1=iRSIGet(1);
if(rsi_2==EMPTY_VALUE || rsi_1==EMPTY_VALUE)
return;
//---if(rsi_2>Inp_RSI_Level_UP && rsi_1>Inp_RSI_Level_UP)
m_trade.Sell(1.0);
elseif(rsi_2<Inp_RSI_Level_DOWN && rsi_1<Inp_RSI_Level_DOWN)
m_trade.Buy(1.0);
}
This is how the adviser works now: we check the signal ONLY AT THE MOMENT OF THE BIRTH OF A NEW BAR. The new bar has index # 0, we call the new bar "Current Bar". Example of a BUY signal: if the two previous bars (bar # 1 and bar # 2) are below the '30' line, this is a BUY signal:
Pic. 1. iRSI simple advisor, version1.006
The code:
Couldn't get it to work... This is the file for the EA, please help me look at it to understand me.
I want it to check the current bar till the the parameters or conditions are met and once it is it it normally opens a buy but instead I want it to hold that request then trigger the buy on the new candle open or when the current candle ends (still the same thing)
Your EA is checking it bars after bars meaning each bar is showing the average, I'm checking every tick with my EA and once that tick in the current bar fulfils my conditions I want the buy to be triggered on the next bar.
aodunusi: Couldn't get it to work... This is the file for the EA, please help me look at it to understand me.
I want it to check the current bar till the the parameters or conditions are met and once it is it it normally opens a buy but instead I want it to hold that request then trigger the buy on the new candle open or when the current candle ends (still the same thing)
Your EA is checking it bars after bars meaning each bar is showing the average, I'm checking every tick with my EA and once that tick in the current bar fulfils my conditions I
The buy gets triggered immediately after the signal is received and the signal is usually slow, so I want to delay the buy from the current candle to the next candle after the condition has been met. I.E I am checking the ticks of the former candle and once my condition has been met, I want to delay or hold the buy or sell order to the next bar that opens or when the current bar closes (they are the same thing though)
aodunusi : Couldn't get it to work... This is the file for the EA, please help me look at it to understand me.
I want it to check the current bar till the the parameters or conditions are met and once it is it it normally opens a buy but instead I want it to hold that request then trigger the buy on the new candle open or when the current candle ends (still the same thing)
Your EA is checking it bars after bars meaning each bar is showing the average, I'm checking every tick with my EA and once that tick in the current bar fulfils my conditions I want the buy to be triggered on the next bar.
Thanks for the help so far
iRSI simple advisor, version1.007
In this version: the signal is checked at each tick: as soon as the signal is received, we immediately stop the search for the signal and wait for a new bar. At the time of the birth of a new bar (if there is a saved signal), open a position.
Gets history data of MqlRates structure of a specified symbol-period in specified quantity into the rates_array array. The elements ordering of the copied data is from present to the past, i.e., starting position of 0 means the current bar. If you know the amount of data you need to copy, it should better be done to a statically allocated...
Example: delete all pending orders of a certain type.
An example in the form of a script: in the input parameter 'Delete all:' the type of a pending order is set and then the delete function 'DeleteOrders' iscalled
this is the simplest example: there is no filter by symbol, there is no filter by Magic number, there is no verification of the minimum distance (level of freezing), and there is no cycle to guarantee deletion.
Trade classes CPositionInfo and COrderInfo are used (Do not confuse current pending orders with positions, which are also displayed on the "Trade" tab of the "Toolbox" of the client terminal.)
You need to redo the code: request data not from one bar, but from two. And check the condition not on one bar - but on two.
It was (#23 ):
Will be:
Thanks. Ive tried editing it but ive almost scattered the entire code. How can i edit this please to add the buy on next bar instead of immediately i.e either at close price of present candle or at new candle open price. Or even to tell it to check the last bar if conditions were met then trigger buy (dont think it would work well but what do i know)
Thanks. Ive tried editing it but ive almost scattered the entire code. How can i edit this please to add the buy on next bar instead of immediately i.e either at close price of present candle or at new candle open price. Or even to tell it to check the last bar if conditions were met then trigger buy (dont think it would work well but what do i know)
Thanks. Ive tried editing it but ive almost scattered the entire code. How can i edit this please to add the buy on next bar instead of immediately i.e either at close price of present candle or at new candle open price. Or even to tell it to check the last bar if conditions were met then trigger buy (dont think it would work well but what do i know)
iRSI simple advisor, version1.006
This is how the adviser works now: we check the signal ONLY AT THE MOMENT OF THE BIRTH OF A NEW BAR. The new bar has index # 0, we call the new bar "Current Bar". Example of a BUY signal: if the two previous bars (bar # 1 and bar # 2) are below the '30' line, this is a BUY signal:
Pic. 1. iRSI simple advisor, version1.006
The code:
iRSI simple advisor, version1.006
This is how the adviser works now: we check the signal ONLY AT THE MOMENT OF THE BIRTH OF A NEW BAR. The new bar has index # 0, we call the new bar "Current Bar". Example of a BUY signal: if the two previous bars (bar # 1 and bar # 2) are below the '30' line, this is a BUY signal:
Pic. 1. iRSI simple advisor, version1.006
The code:
Couldn't get it to work... This is the file for the EA, please help me look at it to understand me.
Couldn't get it to work... This is the file for the EA, please help me look at it to understand me.
iRSI simple advisor, version1.007
In this version: the signal is checked at each tick: as soon as the signal is received, we immediately stop the search for the signal and wait for a new bar. At the time of the birth of a new bar (if there is a saved signal), open a position.
Example CopyRates
The first form of calling CopyRates is used:
Please note that ArraySetAsSeries is applied to the ' rates ' array - in this case, rates [0] corresponds to the rightmost bar on the chart.
The full code:
Result:
Example: delete all pending orders of a certain type.
An example in the form of a script: in the input parameter ' Delete all: ' the type of a pending order is set and then the delete function 'DeleteOrders ' is called
this is the simplest example: there is no filter by symbol, there is no filter by Magic number, there is no verification of the minimum distance (level of freezing), and there is no cycle to guarantee deletion.
Example: Calculate Positions and Pending Orders
Code: Calculate Positions and Pending Orders.mq5
Trade classes CPositionInfo and COrderInfo are used (Do not confuse current pending orders with positions, which are also displayed on the "Trade" tab of the "Toolbox" of the client terminal.)
The code:
A simple example. Displaying iADX indicator values on a chart
This is a simple example: how to get the values of the iADX indicator. For control, the obtained values are displayed on the screen.
Code:
Result: