Hello.
I try to make a sell condition that sell when stock take profit more thatn 15%.
Can you share your idea to me?,please
Thank you.
Hello.
I try to make a sell condition that sell when stock take profit more thatn 15%.
Can you share your idea to me?,please
Thank you.
Hello, snoopy.pa30
Can you check code?
It isn't work or Where did I go wrong? because It doesn't sell when the profit is more than 15%.
SetOption("InitialEquity",100000);
SetOption("MaxOpenPositions",Optimize("MaxOpen",10,10,30,5));
SetOption("MinShares",100);
RoundLotSize = 100;
SetOption("CommissionMode",1);
SetOption("CommissionAmount",0.2);
SetTradeDelays( 1,1,0,0);
//Prepare data
Checkdata = StrToDateTime("2020-Jan-3");
CheckMA = C < MA(C,52);
Plot(MA(C,52),"MA52",colorBrown,styleLine);
Plot( C, "Price", colorDefault, styleCandle );
CheckStop = ApplyStop(1,1,15);
//Buy condition
Buy = Checkdata == DateTime();
Check = Checkdata == DateTime();
Plot(Check,"Checkdate",colorGreen,styleLine);
//Sell condition
Sell = CheckStop;
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
try
Sell = 0;
ApplyStop(1,1,15);
Hello peter1
Thank you.
It's work.
but in my test, I have other condition
SellCon1 = Applystop(1,1,15);
SellCon2 = C < MA(C,52);
I want to make this
Sell = SellCon1 and Sellcon 2;
Do you have idea?
Thank you.
Read the documentation carefully.
Applystop is function returning nothing.
https://www.amibroker.com/guide/afl/applystop.html
Sell = C < MA(C,52);
Applystop(stopTypeProfit, stopModePercent, 15, 1);
Also read knowledge base completely.
And use search there to look for applystop examples.
Hello fxshrat.
I'm sorry for asking a question that's too easy.
This is a result.
SetOption("InitialEquity",100000);
SetOption("MaxOpenPositions",Optimize("MaxOpen",10,10,30,5));
SetOption("MinShares",100);
RoundLotSize = 100;
SetOption("CommissionMode",1);
SetOption("CommissionAmount",0.2);
SetTradeDelays( 0,0,0,0);
//Prepare data
Checkdata = StrToDateTime("2020-Jan-3");
CheckMA = C < MA(C,52);
Plot(MA(C,52),"MA52",colorBrown,styleLine);
Plot( C, "Price", colorDefault, styleCandle );
CheckStop = ApplyStop(1,1,15);
//Buy condition
Buy = Checkdata == DateTime();
Check = Checkdata == DateTime();
Plot(Check,"Checkdate",colorGreen,styleLine);
//Sell condition
Sell = C < MA(C,52);
Applystop(stopTypeProfit, stopModePercent, 15, 1);
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.