Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
can you put in words what you are trying to do?
Your entry price is likely a lot lower than the market price, therefore the limit price won't be executed.
That's why I am asking for your logic, to understand what you are trying to accomplish.
Thanks for the answer ABCTG!
Yes you are right, the price is little bit lower!
I will try to explain:
Stock closes at 100 to day with ATR(10) of 2,5.
I want to buy the stock next day at 99,75.
Thanks ABCTG!
I am getting something wrong, try it in plain English.
Buy Limit = Close - 0,1 * ATR(10)
ProfitTarget = 1 * ATR(10)
StopLoss = 3 *ATR(10)
Exit if TradeDay + 5 sell at market
Seems not so complicated but I am totally stuck....
Here is my code so far:
/gibban
Input: {-------------------------------------------------------------------------------------}
RSIThreshold(10),
RSILookback(2),
ATRThreshold(10),
ATRBuyLimit(0.1),
ATRProfitTarget(1),
ATRStoploss(3),
DayExitPeriod(5);
Variables: {---------------------------------------------------------------------------------}
RSI_Value(0),
MA200(0),
ATR(0),
MP(0);
{=== START OF MAIN PROGRAM ================================================================}
RSI_Value = RSI(Close,RSILookback);
MA200 = Average(Close, 200);
ATR = AverageTrueRange(AtrThreshold);
MP = MarketPosition;
//SetupDay +1 day
If ( RSI_Value <= RSIThreshold ) And ( Close > MA200 ) Then
Buy ("Long") next bar at Close - ATRBuyLimit limit;
//Exit days
If ( Barssinceentry = DayExitPeriod ) Then sell ("DayExitPeriod") this bar at close;
//Stops
//If ATR <= ATRStoploss Then sell ("ATRStoploss") at market;
//If MP = 1 Then Sell ("AAA") next bar at ( EntryPrice - ( ATRStoploss * ATR) ) limit;
//Target
//If MP = 1 then Sell ("LTarget") Next bar at (EntryPrice + (ATRProfitTarget * ATR)) Limit;
//If ( ATRThreshold <> 0 ) Then SetStopLoss( ATRProfitTarget );
{== END OF MAIN PROGRAM ===================================================================}
with the current code your entry is equal to Close - 0.10, which doesn't seem to be what you have in mind.
As you have the ATR computed and stored within a variable already you can do modify your code to this:
//SetupDay +1 day
If ( RSI_Value <= RSIThreshold ) And ( Close > MA200 ) Then
Buy ("Long") next bar at Close - ATRBuyLimit * ATR limit;
Regards,
ABCTG
Gibban
Thanks ABCTG!
I am getting something wrong, try it in plain English.
Buy Limit = Close - 0,1 * ATR(10)
ProfitTarget = 1 * ATR(10)
StopLoss = 3 *ATR(10)
Exit if TradeDay + 5 sell at market
Seems not so complicated but I am totally stuck....
Here is my code so far:
/gibban
Input: {-------------------------------------------------------------------------------------}
RSIThreshold(10),
RSILookback(2),
ATRThreshold(10),
ATRBuyLimit(0.1),
ATRProfitTarget(1),
ATRStoploss(3),
DayExitPeriod(5);
Variables: {---------------------------------------------------------------------------------}
RSI_Value(0),
MA200(0),
ATR(0),
MP(0);
{=== START OF MAIN PROGRAM ================================================================}
RSI_Value = RSI(Close,RSILookback);
MA200 = Average(Close, 200);
ATR = AverageTrueRange(AtrThreshold);
MP = MarketPosition;
//SetupDay +1 day
If ( RSI_Value <= RSIThreshold ) And ( Close > MA200 ) Then
Buy ("Long") next bar at Close - ATRBuyLimit limit;
//Exit days
If ( Barssinceentry = DayExitPeriod ) Then sell ("DayExitPeriod") this bar at close;
//Stops
//If ATR <= ATRStoploss Then sell ("ATRStoploss") at market;
//If MP = 1 Then Sell ("AAA") next bar at ( EntryPrice - ( ATRStoploss * ATR) ) limit;
//Target
//If MP = 1 then Sell ("LTarget") Next bar at (EntryPrice + (ATRProfitTarget * ATR)) Limit;
//If ( ATRThreshold <> 0 ) Then SetStopLoss( ATRProfitTarget );
{== END OF MAIN PROGRAM ===================================================================}
are you using the build in reserved word SetStopLoss or your own code?
How do you arrive at 93.8 when the closing price is 100 and the ATR[100] is 2? What is the formula you are using to compute the stop price?
Regards,
ABCTG
Gibban
Hi ABCTG!
Can you give me a little hand with the StopLoss function?
Everything is calculated from the closing price on the setup day, and I can not find anything in Easy Language about that at all!
Closing price day X is 100 and ATR[10] is 2, then the StopLoss is suppose to be 93,8.