How to code? - page 214

 
Linuxser:
By buffer or by instruction

By instruction is something like

#property indicator_level1 30

#property indicator_level2 70

lets say i wish to draw 80% level on the momemtum indicator takingthe array max and array min values

how to draw that line

i do get the 80% value, but how to put it on chart

 
 
Tio Patinhas:
Hi guys !!

It should work. Show us the whole code.

 
Roger09:
It should work. Show us the whole code.

Problem resolved... Thanks !

 

GlobalVariable help....

I'd like to create 2 GlobalVariable so that when my EA restarts it knows to use these two variables if they exist

The first is the value of a currency when an order (the first order) was placed, I call this variable center. It is the center value ie. Bid + Ask / 2 = center

The second is count ...Just a simple count that I increase by one with every new order.....until I close them all and the count is reset to zero.

//=======================================================

Will this work to check for Global Variables "center" and "count"....and if found write the values to the variables center and count in my EA?

if (GlobalVariableCheck(center))

if (GlobalVariableCheck(count))

{

center = (GlobalVariableGet(center));

count = (GlobalVariableGet(count));

AskStart=1;

BidStart=1;

}

//==============================================================

Will this (assuming AskStart and BidStart are zero) write the center value to the GlobalVariable "center"

if(AskStart==0)

if(BidStart==0)

{

AskStart = NormalizeDouble((Ask),4);

BidStart=NormalizeDouble((Bid),4);

center=((AskStart+BidStart)/2);

NormalizeDouble((center),4);

Print(center);

AskStart=1;

BidStart=1;

Comment(center);

GlobalVariableSet("center",center);

}

//=====================================================================

Will this write the value of count to GlobalVariable "count"?

tic = -1;

if(TradeLong)

if(center>(Ask+sh1))

if (count==1)

{

while((tic == -1 )&¢er>(Ask+sh1))

{

Sleep(4000);

RefreshRates();

tic = OrderSend(Symbol(),OP_BUY,LE1, NormalizeDouble((Ask),4),5,Ask-sl1*Point,0,"",255,0,CLR_NONE);

}

if (tic != -1)

{

count=2;

GlobalVariableSet("count", count);

tic = -1;

}

else

{

return(0);

}

while((tic == -1 )&¢er>(Ask+sh1))

{

Sleep(4000);

RefreshRates();

tic = OrderSend(Symbol(),OP_SELL,LE00, NormalizeDouble((Bid),4),5,Bid+sl0*Point,Bid-tp000*Point,"",255,0,CLR_NONE);

}

return(0);

}

//==============================================

Will this Delete GlobalVariable count and center??

if(OrdersTotal()==0)

{

Closenow=False;

count=1;

AskStart=0;

BidStart=0;

center=0;

Hedgeonce=1;

GlobalVariableDel(center);

GlobalVariableDel(count);

}

Thank you for your help and review.....

 

simple ea

is there an EA that opens trades at a set time of day, and lets you set prices....exit strategy.....all variables

 

Fixed lot to determine SL

Hello

I have been attempting to make a SL that it derived from the % risked and Lot Size.

Example

Balance 2000

Risk 2%

Cash At risk $40.00 = Balance * Risk

Lot Size 0.02

TickValue 10.00 or as determined by each pair.

TickSize 0.2 = TickValue * LotSize

SL 200 = Cash at Risk / TickSize.

So the SL would be placed 200 pips from the open.

the Lot Size should increase by 0.01 every 1000 Dollars.

This is what I have so far

double Lots;

if(OrderSelect(0,SELECT_BY_POS,MODE_HISTORY)) {

if(OrderType()==0 && OrderProfit()>0) {

if(AccountBalance()>1000*2) Lots=MathAbs(MathCeil(-AccountBalance()/OrderProfit()))*0.01;

else Lots=0.01;

Any Help would be great

Cheers

Beno

 

Gidday

How do you use the bar open as the pivot point. example

If the Bid moves above the open buy and hits TP (with any luck) and reverses then the Ask moves below the open so open a sell.

I do realize the if the TP is not hit and the could be another position opened.

any help would be great.

Regards

Beno

 

LimitOrders, which is open?

Hi,

I want to write my own EA.

First I send a SellLimit and a BuyLimit.

Then I want to see, which Orders of them are reached. How can I see which order is still open??

When I look at OrdersTotal() is get my OPEN and PENDING Orders.

Lot's of thanks,

sunshineh

 

by OrderType( )

OP_BUY - buying position,

OP_SELL - selling position,

OP_BUYLIMIT - buy limit pending position,

OP_BUYSTOP - buy stop pending position,

OP_SELLLIMIT - sell limit pending position,

OP_SELLSTOP - sell stop pending position.

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

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderType() == OP_BUY) {...do some thing....}

if(OrderType() == OP_SELL) {...do other thing....}

}

Reason: