Jump to content
meatskin2000

help with risk %

Recommended Posts

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

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.