Jump to content

We have moved to Discord. Please click here to join us in the Trading Terminal Discord server.



These forums are read-only.

meatskin2000

help with risk %

Recommended Posts

meatskin2000

Could someone help me set this script to “risk 1R to make 1.25R”  so either I lose 1R or profit 1.25R?  thx in advance.

 

Short

 

CXL ALLSYMB;

$buyprice=Bid;

$risk=69;

$mystop=price;

$pricetostop=$mystop-$buyprice;

$target=Bid-$pricetostop-$pricetostop-$pricetostop;

$amount=$risk/$pricetostop;

ROUND2;

StopPrice=$mystop;

SShare=$amount;

Share=$amount;

TogSShare;

ROUTE=LIMIT;

Price=$buyprice;

TIF=DAY+;

SELL=Send;

TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$target HighPrice:$mystop ACT:BUY QTY:POS TIF:DAY+;

 

Long

 

CXL ALLSYMB;

$buyprice=Ask;

$risk=69;

$mystop=price;

$pricetostop=$buyprice-$mystop;

$target=3*$pricetostop+Ask;

$amount=$risk/$pricetostop;

StopPrice=$mystop;

StopPrice=ROUND2;

SShare=$amount;

Share=$amount;

TogSShare;

ROUTE=LIMIT;

Price=$buyprice;

Price=ROUND2;

TIF=DAY+;

BUY=Send;

TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$mystop HighPrice:$target ACT:SELL QTY:POS TIF:DAY+;

Share this post


Link to post
Share on other sites
peterB

Long
change
 

$target=3*$pricetostop+Ask;


to 

$targettmp=$pricetostop*1.25;$target=$targettmp+Ask;

 

Short

change

 

$target=Bid-$pricetostop-$pricetostop-$pricetostop;

to

 

$targettmp=$pricetostop*1.25;$target=Bid-$targettmp;

i might update the article with this more elegant solution so you can just change 1.25 to whatever number you need.

Share this post


Link to post
Share on other sites

[[Template core/front/global/mobileNavigation is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.