Help me write an EA. I need it to open to buy when two bars hit one point with low candles, and to sell when they hit one point with highs...
I tried to open buy when two bars hit one point with low candlesticks... One of the video tutorials helped me write an EA using indicator, but since I have no experience, I cannot do it on my own... I can't do anything without help.
rapid_minus: local variables: int i,up,dn,zr,Down,Up,Zero; double op_i,cl_i,rezult;
fast_minus: well, here we go again, I don't see SRC. Not to make a mystery out of nothing, here is the full code of my EA for calculating up-down bars over a period, maybe it will help the experts to understand where the error is:
There is nothing to understand here. Dividing an int by an int produces an int regardless of the type of variable receiving the result of the division.
Hi all ) Can you tell me please - how to build a custom indicator in a trading robot (for example I downloaded the Donchian channel indicator code) - here is the code (what to choose from it to draw???
Hi all ) Can you tell me please - how to build a custom indicator in a trading robot (for example I downloaded the Donchian channel indicator code) - here's the code (what to choose from it to draw???
Indicator draws via buffers. The Expert Advisor has no buffers and it only draws objects.
I know where the SRC button is, but after "paste" there is no image of the code. that's what I meant by "can't see the SRC". Right now - do you see the code posted above? I don't see it.
AlexeyVik 30.04.2016 08:12 # There is nothing to understand. When you divide int by int you get int regardless of the type of variable receiving the result of division.Thank you. Indeed, sometimes you get lost in three pine trees.
rapid_minus: I know where the SRC button is, but after "paste" there is no image of the code. that's what I meant by "can't see the SRC". Right now - can you see the code posted above? I don't see it.
what do i do now ??? i have a channel-based strategy - is there an alternative replacement ?
Of course there is. Calculate the values, save them to an array or structure, and use them for your EA. And you can draw the objects from there as well - the values are available.
Help me write an EA. I need it to open to buy when two bars hit one point with low candles, and to sell when they hit one point with highs...
I tried to open buy when two bars hit one point with low candlesticks... One of the video tutorials helped me write an EA using indicator, but since I have no experience, I cannot do it on my own... I can't do anything without help.
local variables: int i,up,dn,zr,Down,Up,Zero;
double op_i,cl_i,rezult;
well, here we go again, I don't see SRC. Not to make a mystery out of nothing, here is the full code of my EA for calculating up-down bars over a period, maybe it will help the experts to understand where the error is:
There is nothing to understand here. Dividing an int by an int produces an int regardless of the type of variable receiving the result of the division.
Here is the SRC button
Hi all ) Can you tell me please - how to build a custom indicator in a trading robot (for example I downloaded the Donchian channel indicator code) - here is the code (what to choose from it to draw???
#property copyright "ps"
#property link ""
//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Magenta
#property indicator_width1 1
#property indicator_width2 1
//---- indicator parameters
extern int periods=20;
//---- indicator buffers
double upper[];
double lower[];
//+------------------------------------------------------------------+
//| Custom indicator initialisation function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
//---- indicator buffers mapping
SetIndexBuffer(0,upper);
SetIndexBuffer(1,lower);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Donchian Channel("+periods+")");
SetIndexLabel(0, "Upper");
SetIndexLabel(1, "Lower");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| now do the dance. |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- calculate values
for(int i=0; i<limit; i++) {
upper[i]=iHigh(Symbol(),Period(),iHighest(Symbol(),Period(),MODE_HIGH,periods,i))
lower[i]=iLow(Symbol(),Period(),iLowest(Symbol(),Period(),MODE_LOW,periods,i));
}
return(0);
}
0
Hi all ) Can you tell me please - how to build a custom indicator in a trading robot (for example I downloaded the Donchian channel indicator code) - here's the code (what to choose from it to draw???
The indicator draws through buffers. There are no buffers in the EA and it has to draw with objects.
what do i do now ??? i have a channel-based strategy - is there an alternative replacement ?
I know where the SRC button is, but after "paste" there is no image of the code. that's what I meant by "can't see the SRC". Right now - can you see the code posted above? I don't see it.
what do i do now ??? i have a channel-based strategy - is there an alternative replacement ?