Hi guys,
Want to ask you if you can help me out, Im struggling with two strategies for two different robots
- place a second larger trade if the current trade is profitable
- place a second trade in the same direction as the current trade if the current trade have moved against me for x pips or $
MazParticipant
Veteran
// Something like this...
inProfit = positionPerf > 0
if inProfit then
// we are in profit
// buy largetPosition shares at market
endif
// ------------------------
if longOnMarket then
pointDrawdown = tradePrice - close
elsif shortOnMarket then
pointDrawdown = close - tradePrice
else
pointDrawdown = 0
// note pointDrawdown expressed as above is a POSITIVE number and if you are in profit it will be a -ve number
// so then...
if pointDrawdown >= myMaxPointDrawdown then
// we reached our threshold
// buy at market
endif
// ps careful with averaging down :-)
Hi again,
so to add a second larger position if the current one is profitable I will use the code:
inProfit = positionPerf > 0
if inProfit then
buy x contract at market
endif
How can one distinguish that it will add to a specific position if I have multiple? lets say I have 2 long positions and 3 short positions, does one add a label to the trades ? I mean I would need one more for sell on market and how does the script decide which one to use?
for instance…
// Buy condition
if c1 then
buy 1 contract at market
endif
// Add a second buy trade if first one is profitable
inProfit = positionPerf > 0
if inProfit then
buy 1 contract at market
endif
// Sell condition
if c1 then
sellshort 2 contract at market
endif
// Add a second sell trade if first one is profitable
inProfit = positionPerf > 0
if inProfit then
sellshort 1 contract at market
endif