Ask! - page 128

 
:: put your extern variables (you made a list) in the same order into your iCustom function, be sure you have them all.
Dave137:
How would I write a iCustom input for an EA. The indicator name is CycleTarget.

Here are the variables of the indicator:

extern int PriceActionFilter=1;

extern int Length=3;

extern int MajorCycleStrength=4;

extern bool UseCycleFilter=false;

extern int UseFilterSMAorRSI=1;

extern int FilterStrengthSMA=12;

extern int FilterStrengthRSI=21;

a=iCustom(NULL,0,????????????,0,0); What do I use to fill in the ???

Confused??

Dave
 

Thanks for your help In10tion

I am not trying to be vague

I will come back when I know what I am trying to say

Thanks again

Jbear

 
:: please check your documentation first (I gave you a link about orderSend)... Only orderSend can fill your comment variable in your order, afterwards you can't change it anymore... so OrderClose has no other option to change it... & put you "print" (log) function whenever there is a confirmation of your order close.
forexarchitect:
help please

where and how can I add a code here so I can add text to my 'comment' column in terminal.

example - I want to add text comment "Order close by condition type 9c"

also, where can i put Print log "Close by condition Type 9c"

thanks

//+------------------------------------------------------------------+

//| Close Condition Type 9c

//| CHECK ACCOUNT HISTORY BALANCE then close biggest price different

//+------------------------------------------------------------------+

void CheckCloseConditionType9c()

{

int ticket1;

double max_dist;

for (;;)

{

ticket1 = -1;

int cnt = OrdersTotal();

for (int i=0; i < cnt; i++)

{

if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;

if (OrderSymbol() != Symbol()) continue;

if (OrderMagicNumber() != Magic) continue;

int type = OrderType();

if ((type == OP_BUY || type == OP_SELL) == false) continue;

RefreshRates();

if (ticket1 == -1 || MathAbs(Bid - OrderOpenPrice()) > max_dist)

{

ticket1 = OrderTicket();

max_dist = MathAbs(Bid - OrderOpenPrice());

}

}

if (ticket1 == -1) break;

//-----

double today_hist_profit = GetTodayProfit(MODE_HISTORY);

if (today_hist_profit <= Profit2ExitTodayBalance) break;

if (OrderSelect(ticket1, SELECT_BY_TICKET))

{

double lot = PartialCloseLot;

if (lot > OrderLots()) lot = OrderLots();

for (i=0; i < RepeatN; i++)

{

RefreshRates();

bool res = OrderClose(OrderTicket(), lot, OrderClosePrice(), Slippage, clClose);

if (res) break;

}

}

}

}
 
Linuxser:
Hi JBear, Just remember to click on "Remember me" with every browser (Firefox, Opera, Explorer, Safari...) and do not higly restric cookies.

Thanks Linuxser.

Done

 

got it... thanks

 

Batch order?

Can anyone help me code a "batch order"? I would like to have something that allows me to enter two seperate positions with the click of a button. I typically trade in hedged positions. I have several different pairs I trade at different times. All I would like to have is an EA that the moment I turn it on, it will (for example) enter me into a 1 lot long on the EURUSD and 1 lot short on the GBPUSD. Can anyone help assist me with this code? It would sure be much nicer to simply hit one button rather than to open one chart click new order, click buy and then race to open the next chart hit new order and sell it.

Thanks,

EZ

 

batch order

Hi,

i'm no coder but I think if I wanted to do this I would look at it slightly differently. have one EA to place one order, buy or sell which you put on charts then when you turn EA on in metatrader it will execute EAs and place the orders based on which charts you have placed EA on.

This way you have multiple instant order placed on several currency charts

Problem is though deciding which you want, buy or sell but it may help you until something better comes up.

PG

 

and or

hello guys

I have a question here... how do I change the following;

extern double MaxLot = 1.50;

double max_lot = GetMaxLot(OP_BUY, OP_SELL);

if (max_lot >= MaxLot) lot = CalcHedgeLot(order_type);

(order_type)]: ", lot);

if (lot == -1) return (lot);

lot = NormalizeDouble(lot, LotPrec);

if (lot > MaxLot) lot = MaxLot;

if (lot < MinLot) lot = MinLot;

return (lot);

}

the above check for OP_BUY AND OP_SELL

question: how do I change it to any OP_BUY ORany OP_SELL

appreciate

 

Can anyone tell me what the MQL4 code is for counting only the visable bars is?

I seem to remember sometime ago that someone posted the code for it but I can't find it anywhere when I search as I'm ever so slightly hampered by what to look for exactly. Off the top of my head I seem to recall it was something like ...

.... int counted_bars = window() or int window() = Bars-window()

But then again, the old gray matter ain't what it used to be ...

 
Sadly:
Can anyone tell me what the MQL4 code is for counting only the visable bars is?

I seem to remember sometime ago that someone posted the code for it but I can't find it anywhere when I search as I'm ever so slightly hampered by what to look for exactly. Off the top of my head I seem to recall it was something like ...

.... int counted_bars = window() or int window() = Bars-window()

But then again, the old gray matter ain't what it used to be ...

Is this what you looking for ?

-----------

int bars_count=WindowBarsPerChart();

int bar=WindowFirstVisibleBar();

-----------

Goen

Reason: