help with simple code

Created at 16 Jan 2013, 16:14
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
RC

rcc25

Joined 04.01.2013

help with simple code
16 Jan 2013, 16:14


hi all

i am new to programing and i need some help please

 i need bit of code wchich controls amount of opened positions

i ve made little robot and it works ok but it opens to many orders

i want option to limit them for amount i will set up in robot settings

for example on start it opens two positions and i want open two new positions when previous two are closed

what paremetrs i need and what bit of code 

thx

raf


@rcc25
Replies

supafly
16 Jan 2013, 17:35

RE:
rcc25 said:

hi all

i am new to programing and i need some help please

 i need bit of code wchich controls amount of opened positions

i ve made little robot and it works ok but it opens to many orders

i want option to limit them for amount i will set up in robot settings

for example on start it opens two positions and i want open two new positions when previous two are closed

what paremetrs i need and what bit of code 

thx

raf

hi rcc25,

not to sure but try this code under OnBar() or under OnTick()

if (Account.Positions.Count < 3)

{

      your code

}


@supafly

rcc25
16 Jan 2013, 18:41

RE: RE:



it works now thx very much supafly

 


@rcc25