Forum

Only trade once per bar

How do I code a trade only once per bar. I cannot seem to get it

Opening multiple orders

trade.Buy( 0.02 , NULL ,PriceInfo[ 1 ].close,PriceInfo[ 1 ].low, 2 *PriceInfo[ 1 ].high-PriceInfo[ 9 ].low, NULL ); How come does this open multiple trades on a candle instead of only on the value of the previous low

Partial close orders

if ( PositionsTotal ()> 0 ){ for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--){ string symbol= PositionGetSymbol (i); if ( _Symbol ==symbol) { ulong Ticket = PositionGetInteger ( POSITION_TICKET ); double sl = PositionGetDouble ( POSITION_SL ); double tp = PositionGetDouble ( POSITION_TP ); double

shorter horizontal line

I am struggling to find a way to make the horizontal line only start from the bottom of the candle and go out 4 bars instead of infinite I also don't know how to place horizontal lines at each of these conditions instead of it repainting, I would like it to hold its location and just spawn a new one

My ea is not working, I am trying to find resistance and support lines however there is no trades happening

Any help would be much appreciated. //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick () { //--- // Ask & Bid double Ask=

I do not know how to code a position select and modifier.

This is my line of codes. However it is not working, any help would be greatly appreciated

Coding BB into MACD

Hello I currently am having an issue, I am trying to code the BB into the MACD Indicator . Any help would be greatly appreciated

How to save variable outside of if statement

I do not know how to save a variable outside of my if statement in my code: the variables I wish to save are double buyzone; double buysl; double buytp; double sellzone; double sellsl; double selltp; Code is: void OnTick () { //--- // Ask & Bid double Ask= NormalizeDouble ( SymbolInfoDouble (

EA doesn't buy at open but instead buys along the entire candle instead of a set price

I am using the trade.Buy function and for price I put iClose or iOpen(0). However it isnt following the command and is instead buying like this: trade.Buy( 0.01 , NULL , iClose ( NULL , PERIOD_M1 , 1 ), MathMin (low1,low2),Ask+ 3 *ATR, NULL ); Any help would be amazing

Coding a trailing stop

My code for a trailing stop does not work, can someone please advise me on what is wrong with the code if ( PositionsTotal ()> 0 ){ for ( int i= 0 ;i>= 0 ;i++) { /* string position =PositionGetSymbol( i); int TYPE=PositionGetInteger(POSITION_TYPE); // buy if(TYPE==POSITION_TYPE_BUY); {