Hi there every one.
I've figured out the basics, but my problem now is that I get a high/low for every tick. I wouuld like to only have a high/low for every HAS bar. Any whay that I can do this?
Where should I put the variable[x]?
Thanks for the input.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi there.
I'm using the Heinek Asi smoothed (HAS) indicator to determan the buy / sell of the trates. At the moment I just use the following code.
if (four_haOpen<four_haClose) {fourhourbuy=true;COL5=Blue;} else {fourhourbuy=false; COL5=Red;}
if (one_hour_haOpen<one_hour_haClose) {onehourbuy=true;COL4=Blue;} else {onehourbuy=false; COL4=Red;}
if (one_day_haOpen<one_day_haClose) {daybuy=true;COL6=Blue;} else {daybuy=false; COL6=Red;}
if (one_week_haOpen<one_week_haClose) {weekbuy=true;COL7=Blue;} else {weekbuy=false; COL7=Red;}
if (one_month_haOpen<one_month_haClose) {monthbuy=true;COL8=Blue;} else {monthbuy=false; COL8=Red;}
if(OrdersTotal()<1)
{
if (monthbuy&&weekbuy)
{
nTicket=OrderSend(Symbol(),OP_BUY,LOT,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"HA Order",Magic,0,Green);
}
if (!monthbuy&&!weekbuy)
{
nTicket=OrderSend(Symbol(),OP_SELL,LOT,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"HA Order",Magic,0,Green);
}
}
I figured out the if haOpen<haClose then buy and vica versa. But know I want to compare the previos HAS bar to the latest one. I assume it's some kind of arry but how do I save the previos HAS bar?
Do I use the ibars, but I think that is related to the actual trading bars and not the HAS bars.
I can figure out the if/while/then, but I just the command to save it in the arry or variable eg. double oldhas.
Here is a visual of what I'm trying to do/get